diff options
Diffstat (limited to 'static')
-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); } }); |