mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-09-18 21:50:56 +00:00
Favicons and titles for saved searches. Now needs to work.
This commit is contained in:
parent
3435bac504
commit
83dcf3c7a6
4 changed files with 47 additions and 5 deletions
|
@ -1057,6 +1057,8 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
return this.starred_feeds.get(feed_id);
|
||||
} else if (_.string.startsWith(feed_id, 'search:')) {
|
||||
return this.searches_feeds.get(feed_id);
|
||||
} else if (_.string.startsWith(feed_id, 'river:')) {
|
||||
return this.get_folder(feed_id);
|
||||
} else {
|
||||
return this.feeds.get(feed_id);
|
||||
}
|
||||
|
@ -1102,6 +1104,9 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
},
|
||||
|
||||
get_folder: function(folder_name) {
|
||||
if (_.string.startsWith(folder_name, 'river:')) {
|
||||
folder_name = folder_name.replace('river:', '');
|
||||
}
|
||||
return this.folders.find_folder(folder_name.toLowerCase());
|
||||
},
|
||||
|
||||
|
|
|
@ -2,7 +2,9 @@ NEWSBLUR.Models.SavedSearchFeed = Backbone.Model.extend({
|
|||
|
||||
initialize: function() {
|
||||
var feed_title = this.feed_title();
|
||||
var favicon_url = this.favicon_url();
|
||||
this.set('feed_title', "\"<b>" + this.get('query') + "</b>\" on <b>" + feed_title + "</b>");
|
||||
this.set('favicon_url', favicon_url);
|
||||
this.views = [];
|
||||
},
|
||||
|
||||
|
@ -12,8 +14,9 @@ NEWSBLUR.Models.SavedSearchFeed = Backbone.Model.extend({
|
|||
|
||||
if (feed_id == 'river:') {
|
||||
feed_title = "All Site Stories";
|
||||
} else if (_.isNumber(feed_id) || _.string.startsWith(feed_id, 'river:')) {
|
||||
feed_title = NEWSBLUR.assets.get_feed(this.get('feed_id')).get('feed_title');
|
||||
} else if (_.string.startsWith(feed_id, 'river:')) {
|
||||
console.log(['river feed?', feed_id, NEWSBLUR.assets.get_feed(feed_id)]);
|
||||
feed_title = NEWSBLUR.assets.get_feed(feed_id).get('folder_title');
|
||||
} else if (feed_id == "read") {
|
||||
feed_title = "Read Stories";
|
||||
} else if (_.string.startsWith(feed_id, 'starred:')) {
|
||||
|
@ -26,6 +29,10 @@ NEWSBLUR.Models.SavedSearchFeed = Backbone.Model.extend({
|
|||
if (model) {
|
||||
feed_title = feed_title + " - " + model.get('tag');
|
||||
}
|
||||
} else if (_.string.startsWith(feed_id, 'feed:')){
|
||||
feed_title = NEWSBLUR.assets.get_feed(parseInt(this.get('feed_id').replace('feed:', ''), 10)).get('feed_title');
|
||||
} else if (_.string.startsWith(feed_id, 'social:')){
|
||||
feed_title = NEWSBLUR.assets.get_feed(this.get('feed_id')).get('feed_title');
|
||||
}
|
||||
|
||||
return feed_title;
|
||||
|
@ -40,6 +47,31 @@ NEWSBLUR.Models.SavedSearchFeed = Backbone.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
favicon_url: function() {
|
||||
var url;
|
||||
var feed_id = this.get('feed_id');
|
||||
|
||||
if (feed_id == 'river:') {
|
||||
url = NEWSBLUR.Globals.MEDIA_URL + 'img/icons/circular/ak-icon-allstories.png';
|
||||
} else if (_.string.startsWith(feed_id, 'river:')) {
|
||||
url = NEWSBLUR.Globals.MEDIA_URL + 'img/icons/circular/g_icn_folder.png';
|
||||
} else if (feed_id == "read") {
|
||||
url = NEWSBLUR.Globals.MEDIA_URL + 'img/icons/circular/g_icn_unread.png';
|
||||
} else if (_.string.startsWith(feed_id, 'starred:')) {
|
||||
url = NEWSBLUR.Globals.MEDIA_URL + 'img/reader/tag.png';
|
||||
} else if (_.string.startsWith(feed_id, 'feed:')) {
|
||||
url = $.favicon(parseInt(feed_id.replace('feed:', ''), 10));
|
||||
} else if (_.string.startsWith(feed_id, 'social:')) {
|
||||
url = $.favicon(NEWSBLUR.assets.get_feed(feed_id));
|
||||
}
|
||||
|
||||
if (!url) {
|
||||
url = NEWSBLUR.Globals.MEDIA_URL + 'img/icons/circular/g_icn_search_black.png';
|
||||
}
|
||||
|
||||
return url;
|
||||
},
|
||||
|
||||
is_social: function() {
|
||||
return false;
|
||||
},
|
||||
|
|
|
@ -1327,6 +1327,7 @@
|
|||
this.model.feeds.deselect();
|
||||
this.model.stories.deselect();
|
||||
this.model.starred_feeds.deselect();
|
||||
this.model.searches_feeds.deselect();
|
||||
if (_.string.contains(this.active_feed, 'social:')) {
|
||||
this.model.social_feeds.deselect();
|
||||
}
|
||||
|
@ -4666,7 +4667,7 @@
|
|||
|
||||
if (_.contains(['starred', 'read'], feed_id)) {
|
||||
// Umm, no. Not yet.
|
||||
} else if (feed) {
|
||||
} else if (feed && feed.unread_counts) {
|
||||
return feed.unread_counts();
|
||||
} else if (this.flags['river_view'] && !this.flags['social_view']) {
|
||||
var collection;
|
||||
|
|
|
@ -53,9 +53,13 @@ NEWSBLUR.Views.FeedSearchHeader = Backbone.View.extend({
|
|||
// ==========
|
||||
|
||||
save_search: function(e) {
|
||||
NEWSBLUR.assets.save_search(NEWSBLUR.reader.active_feed, NEWSBLUR.reader.flags.search, function(e) {
|
||||
var feed_id = NEWSBLUR.reader.active_feed;
|
||||
if (_.isNumber(feed_id)) {
|
||||
feed_id = "feed:" + feed_id;
|
||||
}
|
||||
NEWSBLUR.assets.save_search(feed_id, NEWSBLUR.reader.flags.search, function(e) {
|
||||
console.log(['Saved searches', e]);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
});
|
Loading…
Add table
Reference in a new issue