mirror of
https://github.com/viq/NewsBlur.git
synced 2025-04-13 09:38:09 +00:00
Opening feeds now works.
This commit is contained in:
parent
9b18d8b58b
commit
04d198d5ce
6 changed files with 46 additions and 45 deletions
|
@ -387,7 +387,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
this.make_request('/reader/feed/'+feed_id,
|
||||
{
|
||||
page: page,
|
||||
feed_address: this.feeds[feed_id].feed_address
|
||||
feed_address: this.feeds.get(feed_id).get('feed_address')
|
||||
}, pre_callback,
|
||||
error_callback,
|
||||
{
|
||||
|
@ -710,7 +710,7 @@ NEWSBLUR.AssetModel = Backbone.Router.extend({
|
|||
var social_feed = this.social_feeds.get(feed_id);
|
||||
return social_feed && social_feed.attributes;
|
||||
} else {
|
||||
return this.feeds[feed_id];
|
||||
return this.feeds.get(feed_id);
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
@ -55,22 +55,22 @@ NEWSBLUR.Views.FeedList = Backbone.View.extend({
|
|||
$('.NB-callout-ftux').fadeOut(500);
|
||||
// this.load_sortable_feeds();
|
||||
_.delay(_.bind(NEWSBLUR.reader.update_starred_count, NEWSBLUR.reader), 250);
|
||||
// NEWSBLUR.reader.check_hide_getting_started();
|
||||
NEWSBLUR.reader.check_hide_getting_started();
|
||||
}
|
||||
|
||||
// if (NEWSBLUR.reader.flags['showing_feed_in_tryfeed_view'] || NEWSBLUR.reader.flags['showing_social_feed_in_tryfeed_view']) {
|
||||
// NEWSBLUR.reader.hide_tryfeed_view();
|
||||
// NEWSBLUR.reader.force_feed_refresh();
|
||||
// }
|
||||
if (NEWSBLUR.reader.flags['showing_feed_in_tryfeed_view'] || NEWSBLUR.reader.flags['showing_social_feed_in_tryfeed_view']) {
|
||||
NEWSBLUR.reader.hide_tryfeed_view();
|
||||
NEWSBLUR.reader.force_feed_refresh();
|
||||
}
|
||||
_.defer(_.bind(function() {
|
||||
// NEWSBLUR.reader.open_dialog_after_feeds_loaded();
|
||||
NEWSBLUR.reader.open_dialog_after_feeds_loaded();
|
||||
|
||||
// if (NEWSBLUR.reader.socket) {
|
||||
// NEWSBLUR.reader.send_socket_active_feeds();
|
||||
// } else {
|
||||
// var force_socket = NEWSBLUR.Globals.is_admin;
|
||||
// NEWSBLUR.reader.setup_socket_realtime_unread_counts(force_socket);
|
||||
// }
|
||||
if (NEWSBLUR.reader.socket) {
|
||||
NEWSBLUR.reader.send_socket_active_feeds();
|
||||
} else {
|
||||
var force_socket = NEWSBLUR.Globals.is_admin;
|
||||
NEWSBLUR.reader.setup_socket_realtime_unread_counts(force_socket);
|
||||
}
|
||||
}, this));
|
||||
},
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ NEWSBLUR.Models.FeedOrFolder = Backbone.Model.extend({
|
|||
initialize: function(model) {
|
||||
if (_.isNumber(model)) {
|
||||
this.feed = NEWSBLUR.assets.feeds.get(model);
|
||||
this.feed.set('subscribed', true, {silent: true});
|
||||
this.set('is_feed', true);
|
||||
} else if (model) {
|
||||
var title = _.keys(model)[0];
|
||||
|
|
|
@ -1503,12 +1503,14 @@
|
|||
}
|
||||
},
|
||||
|
||||
open_feed: function(feed_id, options) {
|
||||
open_feed: function(feed, options) {
|
||||
options = options || {};
|
||||
var self = this;
|
||||
var feed = this.model.get_feed(feed_id) || options.feed;
|
||||
if (feed && _.isNumber(feed)) {
|
||||
feed = this.model.feeds.get(feed) || options.feed;
|
||||
}
|
||||
var $story_titles = this.$s.$story_titles;
|
||||
var temp = feed.temp || !feed.subscribed;
|
||||
var temp = feed.get('temp') || !feed.get('subscribed');
|
||||
|
||||
if (!feed || (temp && !options.try_feed)) {
|
||||
return this.load_feed_in_tryfeed_view(feed_id, options);
|
||||
|
@ -1516,7 +1518,7 @@
|
|||
|
||||
this.flags['opening_feed'] = true;
|
||||
|
||||
if ((options.try_feed || this.model.get_feed(feed_id))) {
|
||||
if (options.try_feed || feed) {
|
||||
$story_titles.empty().scrollTop(0);
|
||||
this.reset_feed();
|
||||
this.hide_splash_page();
|
||||
|
@ -1524,31 +1526,31 @@
|
|||
this.flags['show_story_in_feed'] = options.story_id;
|
||||
}
|
||||
|
||||
this.active_feed = feed_id;
|
||||
this.next_feed = feed_id;
|
||||
this.active_feed = feed.id;
|
||||
this.next_feed = feed.id;
|
||||
|
||||
this.show_stories_progress_bar();
|
||||
$story_titles.data('feed_id', feed_id);
|
||||
$story_titles.data('feed_id', feed.id);
|
||||
this.iframe_scroll = null;
|
||||
this.set_correct_story_view_for_feed(feed_id);
|
||||
this.set_correct_story_view_for_feed(feed.id);
|
||||
$feed_link = options.$feed_link || $('.feed.selected', this.$s.$feed_list).eq(0);
|
||||
this.mark_feed_as_selected(feed_id);
|
||||
this.make_feed_title_in_stories(feed_id);
|
||||
this.mark_feed_as_selected(feed.id);
|
||||
this.make_feed_title_in_stories(feed.id);
|
||||
this.show_feedbar_loading();
|
||||
this.switch_taskbar_view(this.story_view);
|
||||
this.scroll_feed_list_to_show_selected_feed(options.$feed_link);
|
||||
|
||||
_.delay(_.bind(function() {
|
||||
if (!options.delay || feed_id == self.next_feed) {
|
||||
this.model.load_feed(feed_id, 1, true, $.rescope(this.post_open_feed, this),
|
||||
if (!options.delay || feed.id == self.next_feed) {
|
||||
this.model.load_feed(feed.id, 1, true, $.rescope(this.post_open_feed, this),
|
||||
this.show_stories_error);
|
||||
}
|
||||
}, this), options.delay || 0);
|
||||
|
||||
if (!this.story_view || this.story_view == 'page') {
|
||||
_.delay(_.bind(function() {
|
||||
if (!options.delay || feed_id == this.next_feed) {
|
||||
this.load_feed_iframe(feed_id);
|
||||
if (!options.delay || feed.id == this.next_feed) {
|
||||
this.load_feed_iframe(feed.id);
|
||||
}
|
||||
}, this), options.delay || 0);
|
||||
} else {
|
||||
|
@ -1558,8 +1560,8 @@
|
|||
this.setup_mousemove_on_views();
|
||||
|
||||
if (!options.silent) {
|
||||
var slug = _.string.words(_.string.clean(feed.feed_title.replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
|
||||
var url = "site/" + feed_id + "/" + slug;
|
||||
var slug = _.string.words(_.string.clean(feed.get('feed_title').replace(/[^a-z0-9\. ]/ig, ''))).join('-').toLowerCase();
|
||||
var url = "site/" + feed.id + "/" + slug;
|
||||
if (!_.string.include(window.location.pathname, url)) {
|
||||
console.log(["Navigating to url", url]);
|
||||
NEWSBLUR.router.navigate(url);
|
||||
|
@ -3018,7 +3020,7 @@
|
|||
var $content_pane = this.$s.$content_pane;
|
||||
feed_id = feed_id || this.active_feed;
|
||||
var feed = this.model.get_feed(feed_id);
|
||||
var $counter = this.make_feed_counts_floater(feed.ps, feed.nt, feed.ng);
|
||||
var $counter = new NEWSBLUR.Views.FeedCount({model: feed}).render().$el;
|
||||
$counter.css({'opacity': 0});
|
||||
|
||||
$('.feed_counts_floater', $content_pane).remove();
|
||||
|
@ -3471,7 +3473,7 @@
|
|||
if (!feed) return;
|
||||
|
||||
var $feedbar = $.make('div', { className: 'NB-feedbar' }, [
|
||||
$(this.make_feed_title_template(feed, 'story')),
|
||||
new NEWSBLUR.Views.Feed({model: feed, type: 'story'}).render().el,
|
||||
// $.make('div', { className: 'NB-feedbar-intelligence' }, [
|
||||
// $.make('div', { className: 'NB-feed-sentiment NB-feed-like', title: 'What I like about this site...' }),
|
||||
// $.make('div', { className: 'NB-feed-sentiment NB-feed-dislike', title: 'What I dislike about this site...' })
|
||||
|
@ -6929,17 +6931,6 @@
|
|||
});
|
||||
if (stopPropagation) return;
|
||||
|
||||
$.targetIs(e, { tagSelector: '#feed_list .feed:not(.NB-empty)' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
if (!self.flags['sorting_feed']) {
|
||||
var feed_id = parseInt($t.data('id'), 10);
|
||||
if (NEWSBLUR.hotkeys.command) {
|
||||
self.open_unread_stories_in_tabs(feed_id);
|
||||
} else {
|
||||
self.open_feed(feed_id, {$feed_link: $t});
|
||||
}
|
||||
}
|
||||
});
|
||||
$.targetIs(e, { tagSelector: '#feed_list .folder_title .NB-feedlist-collapse-icon' }, function($t, $p){
|
||||
e.preventDefault();
|
||||
stopPropagation = true;
|
||||
|
|
|
@ -4,7 +4,8 @@ NEWSBLUR.Views.Feed = Backbone.View.extend({
|
|||
"contextmenu" : "show_manage_menu",
|
||||
"click .NB-feedlist-manage-icon" : "show_manage_menu",
|
||||
"mouseenter" : "add_hover_inverse_to_feed",
|
||||
"mouseleave" : "remove_hover_inverse_from_feed"
|
||||
"mouseleave" : "remove_hover_inverse_from_feed",
|
||||
"click" : "open"
|
||||
},
|
||||
|
||||
render: function() {
|
||||
|
@ -101,6 +102,14 @@ NEWSBLUR.Views.Feed = Backbone.View.extend({
|
|||
// = Events =
|
||||
// ==========
|
||||
|
||||
open: function(e) {
|
||||
if (NEWSBLUR.hotkeys.command) {
|
||||
NEWSBLUR.reader.open_unread_stories_in_tabs(this.id);
|
||||
} else {
|
||||
NEWSBLUR.reader.open_feed(this.model, {$feed_link: this.$el});
|
||||
}
|
||||
},
|
||||
|
||||
show_manage_menu: function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
NEWSBLUR.Views.FeedCount = Backbone.View.extend({
|
||||
|
||||
render: function() {
|
||||
$(this.el).html(this.render_to_string());
|
||||
this.setElement($(this.render_to_string()));
|
||||
return this;
|
||||
},
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue