diff --git a/app/assets/javascripts/app/frontend/controllers/notes.js b/app/assets/javascripts/app/frontend/controllers/notes.js index 05a1e4cd7..2f35f5d98 100644 --- a/app/assets/javascripts/app/frontend/controllers/notes.js +++ b/app/assets/javascripts/app/frontend/controllers/notes.js @@ -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) { diff --git a/app/assets/templates/frontend/notes.html.haml b/app/assets/templates/frontend/notes.html.haml index 020cfa552..810763227 100644 --- a/app/assets/templates/frontend/notes.html.haml +++ b/app/assets/templates/frontend/notes.html.haml @@ -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