diff options
author | Adam Mathes <adam@trenchant.org> | 2018-04-22 16:31:19 -0700 |
---|---|---|
committer | Adam Mathes <adam@trenchant.org> | 2018-04-22 16:31:19 -0700 |
commit | b376d197b51f2e67c314e23b8ac484dc2ae8f4a5 (patch) | |
tree | 9699832c43969531d6a3576b31f3e6d002e5ede4 /static | |
parent | cd1509967d7dafbf2d1a051206e368bd3aa5e179 (diff) | |
download | neko-b376d197b51f2e67c314e23b8ac484dc2ae8f4a5.tar.gz neko-b376d197b51f2e67c314e23b8ac484dc2ae8f4a5.tar.bz2 neko-b376d197b51f2e67c314e23b8ac484dc2ae8f4a5.zip |
wip single category on feed
Diffstat (limited to 'static')
-rw-r--r-- | static/ui.html | 11 | ||||
-rw-r--r-- | static/ui.js | 27 |
2 files changed, 25 insertions, 13 deletions
diff --git a/static/ui.html b/static/ui.html index 2e002b9..a7bd3a4 100644 --- a/static/ui.html +++ b/static/ui.html @@ -20,6 +20,10 @@ <div id="controls"></div> + <h4 onclick="$('#tags').toggle();">Tags</h4> + <ul id="tags" style="display: none;"> + </ul> + <h4 onclick="$('#feeds').toggle();">Feeds</h4> <ul id="feeds" style="display: none;"> <li><a href="/import/">import</a></li> @@ -39,6 +43,7 @@ </h2> <p class="dateline" style="clear: both;"> <a href="${item.feed_url}">${item.feed_title}</a> | <a href="${item.url}">${item.p_url}</a> + | ${item.feed_category} </p> {{if item.header_image}} <div class="img"><img src="${item.header_image}" /></div> @@ -53,7 +58,9 @@ </script> <script id="tag_template" type="text/jqtmp"> - ${tag.name} ${tag.unread} + {{if tag.selected}}[{{/if}} + ${tag.title} + {{if tag.selected}}]{{/if}} </script> <script id="feed_template" type="text/jqtmp"> @@ -69,8 +76,6 @@ </script> <script id="controls_template" type="text/jqtmp"> - - <ul> <li> <a {{if app.unreadFilter}}style="font-weight: bold;"{{/if}} diff --git a/static/ui.js b/static/ui.js index d76602e..49f6ad0 100644 --- a/static/ui.js +++ b/static/ui.js @@ -21,7 +21,7 @@ var AppModel = Backbone.Model.extend({ boot: function() { this.items.boot(); -// this.tags.boot(); + this.tags.boot(); this.feeds.fetch({set: true, remove: false}) window.setInterval(function() { App.update_read_status() }, 5000); }, @@ -239,9 +239,6 @@ var ItemCollection = Backbone.Collection.extend({ App.loading = true; url = '/stream/'; - if(App.tag != undefined) { - url = url + 'tag/' + App.tag + '/'; - } url=url+'?foo=bar' if(App.get('searchFilter')) { url = url + '&q=' + App.get('searchFilter'); @@ -251,7 +248,10 @@ var ItemCollection = Backbone.Collection.extend({ } if(App.get('starredFilter')) { url = url + '&starred=1'; - } + } + if(App.tag != undefined) { + url = url + '&tag=' + App.tag; + } if(App.items.last()) { url = url + '&max_id=' + App.items.last().get('_id'); } @@ -375,7 +375,7 @@ var TagCollection = Backbone.Collection.extend({ boot: function() { var t = this; - $.getJSON('/tags/', function(data) { + $.getJSON('/tag/', function(data) { $.each(data, function(i,v) { var tag = new Tag(v); t.add(tag); @@ -399,13 +399,20 @@ var TagView = Backbone.View.extend({ render: function() { var h = $.tmpl(templates.tag_template, { 'tag': this.model.toJSON() }); $(this.el).html(h); - if(this.model.get('unread')) { - $(this.el).addClass('hasunread'); - } return this; }, filterTo: function() { - App.tag = this.model.get('name'); + 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(); } }); |