This commit is contained in:
Mo Bitar
2017-02-17 17:54:41 -06:00
parent e98d4f4798
commit 4183200674
4 changed files with 31 additions and 5 deletions

View File

@@ -26,6 +26,8 @@ angular.module('app.frontend')
})
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager) {
this.sortBy = localStorage.getItem("sortBy") || "created_at";
$rootScope.$on("editorFocused", function(){
this.showMenu = false;
}.bind(this))
@@ -110,4 +112,22 @@ angular.module('app.frontend')
}
}.bind(this), 100)
}
this.selectedMenuItem = function() {
this.showMenu = false;
}
this.selectedSortByCreated = function() {
this.setSortBy("created_at");
}
this.selectedSortByUpdated = function() {
this.setSortBy("updated_at");
}
this.setSortBy = function(type) {
this.sortBy = type;
localStorage.setItem("sortBy", type);
}
});

View File

@@ -147,9 +147,7 @@ class ModelManager {
}
} else if(item.content_type == "Note") {
if(!_.find(this.notes, {uuid: item.uuid})) {
this.notes.splice(_.sortedLastIndexBy(this.notes, item, function(item){
return -item.created_at;
}), 0, item);
this.notes.unshift(item);
}
} else if(item.content_type == "Extension") {
if(!_.find(this._extensions, {uuid: item.uuid})) {