1
0
Fork 0

docs view css, added pagesize option for documents

This commit is contained in:
Heiko Kernbach 2014-08-20 13:24:57 +02:00
parent bdbdaaf0bf
commit f21ad2b471
6 changed files with 62 additions and 6 deletions

View File

@ -38,6 +38,20 @@
return this.pagesize;
},
setPageSize: function(newPagesize) {
if (newPagesize === "all") {
this.pagesize = 'all';
}
else {
try {
newPagesize = parseInt(newPagesize, 10);
this.pagesize = newPagesize;
}
catch (ignore) {
}
}
},
setToFirst: function() {
this.page = 0;
},

View File

@ -59,6 +59,10 @@
return query + parts.join(" &&");
},
setPagesize: function(size) {
this.setPageSize(size);
},
resetFilter: function() {
this.filters = [];
},
@ -68,6 +72,7 @@
var self = this,
query,
bindVars,
tmp,
queryObj;
bindVars = {
"@collection": this.collectionID,
@ -81,7 +86,16 @@
if (this.getTotal() < 10000) {
query += " SORT TO_NUMBER(x._key) == 0 ? x._key : TO_NUMBER(x._key)";
}
if (bindVars.count !== 'all') {
query += " LIMIT @offset, @count RETURN x";
}
else {
tmp = {
"@collection": this.collectionID
};
bindVars = tmp;
query += " RETURN x";
}
queryObj = {
query: query,

View File

@ -302,6 +302,17 @@
<div id="documentsToolbarFL">
<div id="documentsToolbarF" class="pagination-line">
</div>
<select id="documentSize" class="documents-size">
<option value="10" selected="">10 results</option>
<option value="20">20 results</option>
<option value="50">50 results</option>
<option value="100">100 results</option>
<option value="500">500 results</option>
<option value="1000">1000 results</option>
<option value="2500">2500 results</option>
<option value="5000">5000 results</option>
<option value="all">All results</option>
</select>
</div>
<!-- Delete Modal -->

View File

@ -86,7 +86,8 @@
"click #confirmDeleteIndexBtn" : "deleteIndex",
"click #documentsToolbar ul" : "resetIndexForms",
"click #indexHeader #addIndex" : "toggleNewIndexView",
"click #indexHeader #cancelIndex" : "toggleNewIndexView"
"click #indexHeader #cancelIndex" : "toggleNewIndexView",
"change #documentSize" : "setPagesize"
},
showSpinner: function() {
@ -105,6 +106,12 @@
$("#docImportModal").modal('hide');
},
setPagesize: function() {
var size = $('#documentSize').find(":selected").val();
this.collection.setPagesize(size);
this.collection.getDocuments(this.getDocsCallback.bind(this));
},
returnPressedHandler: function(event) {
if (event.keyCode === 13) {
if ($("#confirmDeleteBtn").attr("disabled") === false) {

View File

@ -73,14 +73,14 @@
.docsFirstCol {
@extend %docs-col-no-border;
height: 26px;
width: 70%;
width: 80%;
}
.docsSecCol {
@extend %docs-col-no-border;
height: 26px;
min-width: 400px !important;
width: 20%;
width: 10%;
}
.docsThirdCol {
@ -116,3 +116,8 @@
color: $c-breadcrumb-a-active-bread;
}
.documents-size {
float: right;
margin-top: -58px;
width: 115px;
}

View File

@ -6059,12 +6059,12 @@ table .sorting {
.docsFirstCol {
height: 26px;
width: 70%; }
width: 80%; }
.docsSecCol {
height: 26px;
min-width: 400px !important;
width: 20%; }
width: 10%; }
.docsThirdCol {
height: 26px; }
@ -6087,3 +6087,8 @@ table .sorting {
.breadcrumb a.activeBread {
color: #b9d375; }
.documents-size {
float: right;
margin-top: -58px;
width: 115px; }