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; 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() { setToFirst: function() {
this.page = 0; this.page = 0;
}, },

View File

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

View File

@ -302,6 +302,17 @@
<div id="documentsToolbarFL"> <div id="documentsToolbarFL">
<div id="documentsToolbarF" class="pagination-line"> <div id="documentsToolbarF" class="pagination-line">
</div> </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> </div>
<!-- Delete Modal --> <!-- Delete Modal -->

View File

@ -86,7 +86,8 @@
"click #confirmDeleteIndexBtn" : "deleteIndex", "click #confirmDeleteIndexBtn" : "deleteIndex",
"click #documentsToolbar ul" : "resetIndexForms", "click #documentsToolbar ul" : "resetIndexForms",
"click #indexHeader #addIndex" : "toggleNewIndexView", "click #indexHeader #addIndex" : "toggleNewIndexView",
"click #indexHeader #cancelIndex" : "toggleNewIndexView" "click #indexHeader #cancelIndex" : "toggleNewIndexView",
"change #documentSize" : "setPagesize"
}, },
showSpinner: function() { showSpinner: function() {
@ -105,6 +106,12 @@
$("#docImportModal").modal('hide'); $("#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) { returnPressedHandler: function(event) {
if (event.keyCode === 13) { if (event.keyCode === 13) {
if ($("#confirmDeleteBtn").attr("disabled") === false) { if ($("#confirmDeleteBtn").attr("disabled") === false) {

View File

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

View File

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