diff options
author | Adam Mathes <adam@trenchant.org> | 2018-04-22 20:57:32 -0700 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-04-22 20:57:32 -0700 |
commit | 0f46131d74bc2af6a5dd18f67546944981968c43 (patch) | |
tree | 67a608ddedf0388a82b8260983cf78b238296411 | |
parent | 63bde326a39bffe6181a16ad86e782333047cc86 (diff) | |
download | neko-0f46131d74bc2af6a5dd18f67546944981968c43.tar.gz neko-0f46131d74bc2af6a5dd18f67546944981968c43.tar.bz2 neko-0f46131d74bc2af6a5dd18f67546944981968c43.zip |
better unselect feed/tag behavior
-rw-r--r-- | static/ui.js | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/static/ui.js b/static/ui.js index f89f4bf..0cf37e5 100644 --- a/static/ui.js +++ b/static/ui.js @@ -27,19 +27,44 @@ var AppModel = Backbone.Model.extend({ }, filterToFeed: function(feed) { - this.set('feedFilter', feed); if (feed.get('selected')) { feed.set('selected', false); + this.set('feedFilter', undefined); } else { + App.tags.models.forEach ( function (t) { + t.set('selected', false); + }); + App.tag = null; App.feeds.models.forEach ( function (f) { f.set('selected', false); }); + + this.set('feedFilter', feed); feed.set('selected', true); } this.items.reboot(); }, + filterToTag: function(tag) { + App.tag = null; + if (tag.get('selected')) { + tag.set('selected', false); + } + else { + App.tags.models.forEach ( function (t) { + t.set('selected', false); + }); + App.feeds.models.forEach ( function (f) { + f.set('selected', false); + }); + this.set('feedFilter', undefined); + tag.set('selected', true); + App.tag = tag.get('title'); + } + App.items.reboot(); + }, + filterToStarred: function() { this.set('starredFilter', true); this.set('allFilter', false); @@ -411,18 +436,7 @@ var TagView = Backbone.View.extend({ return this; }, filterTo: function() { - App.tag = null; - if (this.model.get('selected')) { - this.model.set('selected', false); - } - else { - App.tags.models.forEach ( function (tag) { - tag.set('selected', false); - }); - this.model.set('selected', true); - App.tag = this.model.get('title'); - } - App.items.reboot(); + App.filterToTag(this.model); } }); |