1
0
Fork 0

browse thru collections

This commit is contained in:
Jan Steemann 2013-02-26 14:04:36 +01:00
parent 5660f007b6
commit 3c621c956f
2 changed files with 29 additions and 4 deletions

View File

@ -2,8 +2,8 @@
<div id="transparentHeader">
<div id="documentsToolbar" class="pagination pagination-small pagination-right">
<ul>
<li class="enabled"><a href="#">&lsaquo;</a></li>
<li class="enabled"><a href="#">&rsaquo;</a></li>
<li class="enabled"><a id="collectionPrev">&lsaquo;</a></li>
<li class="enabled"><a id="collectionNext">&rsaquo;</a></li>
</ul>
</div>
</div>

View File

@ -4,12 +4,20 @@ var documentsView = Backbone.View.extend({
documentsPerPage: 10,
totalPages: 1,
collectionContext : {
prev: null,
next: null
},
alreadyClicked: false,
el: '#content',
table: '#documentsTableID',
events: {
"click #collectionPrev" : "prevCollection",
"click #collectionNext" : "nextCollection",
"click #documentsTableID tr" : "clicked",
"click #deleteDoc" : "remove",
"click #plusIconDoc" : "addDocument",
@ -20,6 +28,23 @@ var documentsView = Backbone.View.extend({
"click #documents_next" : "nextDocuments",
"click #confirmDeleteBtn" : "confirmDelete"
},
buildCollectionLink : function (collection) {
return "#collection/" + encodeURIComponent(collection.get('name')) + '/documents/1';
},
prevCollection : function () {
if (this.collectionContext.prev !== null) {
window.location.hash = this.buildCollectionLink(this.collectionContext.prev);
}
},
nextCollection : function () {
if (this.collectionContext.next !== null) {
window.location.hash = this.buildCollectionLink(this.collectionContext.next);
}
},
addDocument: function () {
var collid = window.location.hash.split("/")[1];
window.arangoDocumentStore.addDocument(collid);
@ -148,7 +173,7 @@ var documentsView = Backbone.View.extend({
template: new EJS({url: '/_admin/html/js/templates/documentsView.ejs'}),
render: function() {
var position = window.arangoCollectionsStore.getPosition(this.colid);
this.collectionContext = window.arangoCollectionsStore.getPosition(this.colid);
$(this.el).html(this.template.text);
this.breadcrumb();
@ -160,7 +185,7 @@ var documentsView = Backbone.View.extend({
$('#transparentHeader').append(
'<div class="breadcrumb">'+
'<a class="activeBread" href="#">Collections</a>'+
' > '+
' &gt; '+
'<a class="disabledBread">'+name+'</a>'+
'</div>'
);