note selection adjustment

This commit is contained in:
Mo Bitar
2017-02-27 12:31:32 -06:00
parent 34bb127489
commit 8462482f46
3 changed files with 8 additions and 16 deletions

View File

@@ -34,10 +34,11 @@ angular.module('app.frontend')
}, 30000); }, 30000);
}); });
$scope.allTag = new Tag({all: true}); var allTag = new Tag({all: true});
$scope.allTag.title = "All"; allTag.title = "All";
$scope.tags = modelManager.tags; $scope.tags = modelManager.tags;
$scope.allTag.notes = modelManager.notes; allTag.notes = modelManager.notes;
$scope.allTag = allTag;
/* /*
Editor Callbacks Editor Callbacks

View File

@@ -32,8 +32,6 @@ angular.module('app.frontend')
this.showMenu = false; this.showMenu = false;
}.bind(this)) }.bind(this))
var isFirstLoad = true;
this.notesToDisplay = 20; this.notesToDisplay = 20;
this.paginate = function() { this.paginate = function() {
this.notesToDisplay += 20 this.notesToDisplay += 20
@@ -51,16 +49,9 @@ angular.module('app.frontend')
tag.notes.forEach(function(note){ tag.notes.forEach(function(note){
note.visible = true; note.visible = true;
}) })
this.selectFirstNote(false);
if(isFirstLoad) { var createNew = tag.notes.length == 0;
$timeout(function(){ this.selectFirstNote(createNew);
this.createNewNote();
isFirstLoad = false;
}.bind(this))
} else if(tag.notes.length == 0) {
this.createNewNote();
}
} }
this.selectedTagDelete = function() { this.selectedTagDelete = function() {
@@ -69,7 +60,7 @@ angular.module('app.frontend')
} }
this.selectFirstNote = function(createNew) { this.selectFirstNote = function(createNew) {
var visibleNotes = this.tag.notes.filter(function(note){ var visibleNotes = this.sortedNotes.filter(function(note){
return note.visible; return note.visible;
}); });

View File

@@ -28,7 +28,7 @@
.scrollable .scrollable
.infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"} .infinite-scroll{"infinite-scroll" => "ctrl.paginate()", "can-load" => "true", "threshold" => "200"}
.note{"ng-repeat" => "note in ctrl.tag.notes | filter: ctrl.filterNotes | orderBy: ctrl.sortBy:true | limitTo:ctrl.notesToDisplay", .note{"ng-repeat" => "note in (ctrl.sortedNotes = (ctrl.tag.notes | filter: ctrl.filterNotes | orderBy: ctrl.sortBy:true | limitTo:ctrl.notesToDisplay))",
"ng-click" => "ctrl.selectNote(note)", "ng-class" => "{'selected' : ctrl.selectedNote == note}"} "ng-click" => "ctrl.selectNote(note)", "ng-class" => "{'selected' : ctrl.selectedNote == note}"}
.name{"ng-if" => "note.title"} .name{"ng-if" => "note.title"}
{{note.title}} {{note.title}}