diff --git a/app/assets/javascripts/app/controllers/tags.js b/app/assets/javascripts/app/controllers/tags.js index 575011f58..1b3e5eedb 100644 --- a/app/assets/javascripts/app/controllers/tags.js +++ b/app/assets/javascripts/app/controllers/tags.js @@ -83,8 +83,8 @@ angular.module('app') this.setTags = function(tags) { if(initialLoad) { - initialLoad = false; - this.selectTag(this.allTag); + initialLoad = false; + this.selectTag(this.allTag); } else { if(tags && tags.length > 0) { this.selectTag(tags[0]); diff --git a/app/assets/javascripts/app/models/app/note.js b/app/assets/javascripts/app/models/app/note.js index e428b6717..4826e7e36 100644 --- a/app/assets/javascripts/app/models/app/note.js +++ b/app/assets/javascripts/app/models/app/note.js @@ -33,6 +33,8 @@ class Note extends Item { } addItemAsRelationship(item) { + this.savedTagsString = null; + if(item.content_type == "Tag") { if(!_.find(this.tags, item)) { this.tags.push(item); @@ -42,6 +44,8 @@ class Note extends Item { } removeItemAsRelationship(item) { + this.savedTagsString = null; + if(item.content_type == "Tag") { _.pull(this.tags, item); } @@ -49,6 +53,8 @@ class Note extends Item { } removeAndDirtyAllRelationships() { + this.savedTagsString = null; + this.tags.forEach(function(tag){ _.pull(tag.notes, this); tag.setDirty(true); @@ -57,6 +63,8 @@ class Note extends Item { } removeReferencesNotPresentIn(references) { + this.savedTagsString = null; + super.removeReferencesNotPresentIn(references); var uuids = references.map(function(ref){return ref.uuid}); @@ -108,6 +116,7 @@ class Note extends Item { } tagsString() { - return Tag.arrayToDisplayString(this.tags); + this.savedTagsString = Tag.arrayToDisplayString(this.tags); + return this.savedTagsString; } } diff --git a/app/assets/templates/notes.html.haml b/app/assets/templates/notes.html.haml index 5797b152a..7c44bee26 100644 --- a/app/assets/templates/notes.html.haml +++ b/app/assets/templates/notes.html.haml @@ -55,7 +55,7 @@ %strong.medium Archived .tags-string{"ng-if" => "ctrl.shouldShowTags(note)"} - .faded {{note.tagsString()}} + .faded {{note.savedTagsString || note.tagsString()}} .name{"ng-if" => "note.title"} {{note.title}}