Reset notes to display length on tag change

This commit is contained in:
Mo Bitar
2017-11-13 23:43:34 -06:00
parent 0df6c2a412
commit 9db343a634
2 changed files with 13 additions and 3 deletions

View File

@@ -49,9 +49,11 @@ angular.module('app.frontend')
this.selectFirstNote(false);
}.bind(this))
this.notesToDisplay = 20;
this.DefaultNotesToDisplayValue = 20;
this.notesToDisplay = this.DefaultNotesToDisplayValue;
this.paginate = function() {
this.notesToDisplay += 20
this.notesToDisplay += this.DefaultNotesToDisplayValue
}
this.optionsSubtitle = function() {
@@ -77,6 +79,14 @@ angular.module('app.frontend')
}
this.tagDidChange = function(tag, oldTag) {
var scrollable = document.getElementById("notes-scrollable");
if(scrollable) {
scrollable.scrollTop = 0;
scrollable.scrollLeft = 0;
}
this.notesToDisplay = this.DefaultNotesToDisplayValue;
this.showMenu = false;
if(this.selectedNote && this.selectedNote.dummy) {

View File

@@ -38,7 +38,7 @@
Show archived notes
.scrollable
.infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
.infinite-scroll#notes-scrollable{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
.note{"ng-repeat" => "note in (ctrl.sortedNotes = (ctrl.tag.notes | filter: ctrl.filterNotes | sortBy: ctrl.sortBy| limitTo:ctrl.notesToDisplay)) track by note.uuid",
"ng-click" => "ctrl.selectNote(note)", "ng-class" => "{'selected' : ctrl.selectedNote == note}"}
%strong.red.medium{"ng-if" => "note.conflict_of"} Conflicted copy