Skip to content
Browse files

elements per page dropdown und index für jeden localekey hinzugefügt

  • Loading branch information...
1 parent ce0e762 commit 52654134d7c873a8a8496669ddeba3f20832f850 Stephan committed
Showing with 32 additions and 13 deletions.
  1. +20 −10 app/modules/localeEdit/views.js
  2. +1 −0 app/templates/localeedit/editItem.html
  3. +11 −3 app/templates/localeedit/filter.html
View
30 app/modules/localeEdit/views.js
@@ -27,7 +27,8 @@ function(app, LocaleEdit, Backbone) {
"click #nextPage" : "NextPage",
"click #prevPage" : "PrevPage",
"click #gotoStart" : "goToStart",
- "click #gotoEnd" : "goToEnd"
+ "click #gotoEnd" : "goToEnd",
+ "change #SelElementsPerPage" : "changeElementsPerPage"
},
goToStart: function(e){
@@ -39,12 +40,15 @@ function(app, LocaleEdit, Backbone) {
mediator.Publish('goToEnd');
return this;
},
-
+ changeElementsPerPage: function(){
+ var elementsPerPage = $("#SelElementsPerPage").val();
+ mediator.Publish('elementsPerPageCHanged', elementsPerPage);
+ return this;
+ },
NextPage: function(e){
mediator.Publish('nextpage');
return this;
},
-
PrevPage: function(e){
mediator.Publish('prevpage');
return this;
@@ -105,7 +109,8 @@ function(app, LocaleEdit, Backbone) {
className: 'edit-wrapper-outer',
data: function() {
- return { model: this.model };
+ return { model: this.model,
+ index: this.model.index };
},
@@ -168,6 +173,7 @@ Views.EditList = Backbone.View.extend({
index +=1;
if(index >= start && count <= this.pageSize ) {
count +=1;
+ locale.index = index;
this.insertView("div.localelistitems", new Views.EditItem({
model: locale
}));
@@ -192,7 +198,6 @@ Views.EditList = Backbone.View.extend({
if(this.currentPage == 0 ) {
return;
};
-
this.goToPage(this.currentPage -= 1);
},
nextPage: function(){
@@ -204,14 +209,19 @@ Views.EditList = Backbone.View.extend({
goToEnd: function(){
this.goToPage((this.collection.length / this.pageSize) +1);
},
+ changeElementsPerPage:function(pageSize){
+ this.pageSize = Number(pageSize);
+ this.render();
+ },
initialize: function() {
this.collection.on("reset", this.render, this);
- mediator.Subscribe('keySearch', this.search, {}, this)
- mediator.Subscribe('nextpage', this.nextPage, {}, this)
- mediator.Subscribe('prevpage', this.prevPage, {}, this)
+ mediator.Subscribe('keySearch', this.search, {}, this);
+ mediator.Subscribe('nextpage', this.nextPage, {}, this);
+ mediator.Subscribe('prevpage', this.prevPage, {}, this) ;
- mediator.Subscribe('goToStart', this.goToStart, {}, this)
- mediator.Subscribe('goToEnd', this.goToEnd, {}, this)
+ mediator.Subscribe('goToStart', this.goToStart, {}, this);
+ mediator.Subscribe('goToEnd', this.goToEnd, {}, this) ;
+ mediator.Subscribe('elementsPerPageCHanged', this.changeElementsPerPage, {}, this);
this.pageSize = 3;
this.currentPage = 1;
View
1 app/templates/localeedit/editItem.html
@@ -1,6 +1,7 @@
<div class="edit-wrapper-inner container ">
<div class="edit-wrapper-inner row-fluid">
<div class="pull-left span4 key hero-unit">
+ <span class="label"><%= index %></span>
<span><%= model.get("LocaleKey") %></span>
</div>
<div class="pull-left span8 values">
View
14 app/templates/localeedit/filter.html
@@ -9,12 +9,20 @@
</div>
<div class="pull-right filter">
- <span id="prevPage" class="label">prev</span>
- <span id="nextPage" class="label">next</span>
+ <span id="prevPage" class="label">< prev</span>
+ <span id="nextPage" class="label">next > </span>
+
+ <select id="SelElementsPerPage" class="dropdown">
+ <option value="5">5</option>
+ <option value="10">10</option>
+ <option value="20">20</option>
+ <option value="25">25</option>
+ <option value="50">50</option>
+ </select>
<span id="gotoStart" class="label">Start</span>
<span id="gotoEnd" class="label">Ende</span>
- <span class="label current-page"><%= currentpage %></span>
+ <span class="label current-page">Seite: <%= currentpage %></span>
</div>
<div class="clearfix"></div>

0 comments on commit 5265413

Please sign in to comment.
Something went wrong with that request. Please try again.