Persist showArchived flag
This commit is contained in:
@@ -34,6 +34,7 @@ angular.module('app.frontend')
|
|||||||
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager) {
|
.controller('NotesCtrl', function (authManager, $timeout, $rootScope, modelManager, storageManager) {
|
||||||
|
|
||||||
this.sortBy = storageManager.getItem("sortBy") || "created_at";
|
this.sortBy = storageManager.getItem("sortBy") || "created_at";
|
||||||
|
this.showArchived = storageManager.getBooleanValue("showArchived") || false;
|
||||||
this.sortDescending = this.sortBy != "title";
|
this.sortDescending = this.sortBy != "title";
|
||||||
|
|
||||||
$rootScope.$on("editorFocused", function(){
|
$rootScope.$on("editorFocused", function(){
|
||||||
@@ -63,7 +64,7 @@ angular.module('app.frontend')
|
|||||||
base += " title";
|
base += " title";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this.showArchived && !this.tag.archiveTag) {
|
if(this.showArchived && (!this.tag || !this.tag.archiveTag)) {
|
||||||
base += " | Including archived"
|
base += " | Including archived"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ angular.module('app.frontend')
|
|||||||
|
|
||||||
this.toggleShowArchived = function() {
|
this.toggleShowArchived = function() {
|
||||||
this.showArchived = !this.showArchived;
|
this.showArchived = !this.showArchived;
|
||||||
|
storageManager.setBooleanValue("showArchived", this.showArchived);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.tagDidChange = function(tag, oldTag) {
|
this.tagDidChange = function(tag, oldTag) {
|
||||||
|
|||||||
@@ -111,6 +111,14 @@ class StorageManager {
|
|||||||
return storage.getItem(key);
|
return storage.getItem(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setBooleanValue(key, value, vault) {
|
||||||
|
this.setItem(key, JSON.stringify(value), vault);
|
||||||
|
}
|
||||||
|
|
||||||
|
getBooleanValue(key, vault) {
|
||||||
|
return JSON.parse(this.getItem(key, vault));
|
||||||
|
}
|
||||||
|
|
||||||
removeItem(key, vault) {
|
removeItem(key, vault) {
|
||||||
var storage = this.getVault(vault);
|
var storage = this.getVault(vault);
|
||||||
storage.removeItem(key);
|
storage.removeItem(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user