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);
});
$scope.allTag = new Tag({all: true});
$scope.allTag.title = "All";
var allTag = new Tag({all: true});
allTag.title = "All";
$scope.tags = modelManager.tags;
$scope.allTag.notes = modelManager.notes;
allTag.notes = modelManager.notes;
$scope.allTag = allTag;
/*
Editor Callbacks

View File

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

View File

@@ -28,7 +28,7 @@
.scrollable
.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}"}
.name{"ng-if" => "note.title"}
{{note.title}}