New feed selector now works to find feed by keyword.

This commit is contained in:
Samuel Clay 2012-09-26 13:49:17 -07:00
parent 2e88ca9691
commit dff45202b1
8 changed files with 267 additions and 39 deletions

View file

@ -449,7 +449,6 @@ class MSocialProfile(mongo.Document):
logging.user(user, "~FMDisabled emails, skipping.")
return
if self.user_id == follower_user_id:
logging.user(user, "~FMDisabled emails, skipping.")
return
emails_sent = MSentEmail.objects.filter(receiver_user_id=user.pk,

View file

@ -51,7 +51,6 @@ javascripts:
- media/js/vendor/jquery.chosen.js
- media/js/vendor/jquery.effects.core.js
- media/js/vendor/jquery.effects.slideOffscreen.js
- media/js/vendor/mousetrap-*.js
# - media/js/vendor/jquery.linkify.js
- media/js/vendor/bootstrap.*.js
- media/js/vendor/audio.js

View file

@ -579,12 +579,11 @@ body.NB-theme-serif #story_pane .NB-feed-story-content {
line-height: 1.3em;
height: 14px;
overflow: hidden;
text-shadow: 0 1px 0 #EBF3FA;
text-shadow: 0 1px 0 rgba(250, 250, 250, .5);
}
.NB-feedlist .feed.selected .feed_title,
.NB-feedlist .feed.NB-selected .feed_title {
text-shadow: 0 1px 0 #FFC97D;
color: #000000;
}
@ -694,16 +693,27 @@ body.NB-theme-serif #story_pane .NB-feed-story-content {
}
.NB-feedlist .feed.selected,
.NB-feedlist .feed.NB-selected {
background: #f6a828 url('/media/css/jquery-ui/images/ui-bg_highlight-hard_35_f6a828_1x100.png') 0 50% repeat-x;
border-top: 1px solid #A8A8A8;
border-bottom: 1px solid #A8A8A8;
background-color: #F6A828;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F7BA55), to(#F6A828));
background: -moz-linear-gradient(center top , #F7BA55 0%, #F6A828 100%);
border-top: 1px solid #C59977;
border-bottom: 1px solid #C59977;
}
.NB-feedlist .folder.NB-selected > .folder_title {
background: #f6a828 url('/media/css/jquery-ui/images/ui-bg_highlight-hard_35_f6a828_1x100.png') 0 50% repeat-x;
border-top: 1px solid #A8A8A8;
border-bottom: 1px solid #A8A8A8;
background-color: #F6A828;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#F7BA55), to(#F6A828));
background: -moz-linear-gradient(center top , #F7BA55 0%, #F6A828 100%);
border-top: 1px solid #C59977;
border-bottom: 1px solid #C59977;
text-shadow: 1px 1px 0 #FAC898;
}
.NB-feedlist .feed.NB-feed-selector-selected {
background-color: #7AC0FE;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#A7D3FE), to(#7AC0FE));
background: -moz-linear-gradient(center top , #A7D3FE 0%, #7AC0FE 100%);
border-top: 1px solid #789FC6;
border-bottom: 1px solid #789FC6;
}
.NB-feedlist .NB-feeds-list-highlight {
@ -752,6 +762,19 @@ body.NB-theme-serif #story_pane .NB-feed-story-content {
.NB-feedlist-hide-read-feeds .NB-feedlist .feed.selected {
display: block;
}
#feed_list.NB-feedlist.NB-selector-active .feed,
.NB-feedlist.NB-socialfeeds.NB-selector-active .feed {
display: none;
}
#feed_list.NB-feedlist.NB-selector-active .feed.NB-feed-selector-active,
.NB-feedlist.NB-socialfeeds.NB-selector-active .feed.NB-feed-selector-active {
display: block;
opacity: 1;
}
.NB-feedlist.NB-selector-active .NB-folder-collapsed .folder {
display: block !important;
opacity: 1 !important;
}
/* ================= */
/* = Unread Counts = */
@ -1296,6 +1319,7 @@ background: transparent;
color: #272727;
line-height: 1em;
background-color: white;
border-bottom: 1px solid #FFF;
}
.NB-story-pane-west #story_titles .story {
padding-right: 4px;
@ -1312,7 +1336,6 @@ background: transparent;
height: 20px;
left: 0;
top: 0;
/* background: transparent url('/media/embed/icons/silk/bullet_orange.png') no-repeat 6px 2px;*/
}
#story_titles .story.NB-story-positive .NB-storytitles-sentiment {
@ -1528,11 +1551,11 @@ background: transparent;
}
#story_titles .story.NB-selected {
color: #304080;
border-top: 1px solid #D7DDE6;
background: #dadada url('/media/css/jquery-ui/images/dadada_40x100_textures_03_highlight_soft_75.png') 0 50% repeat-x;
}
#story_titles .story.after_selected {
border-top: 1px solid #D7DDE6;
border-top: 1px solid #6EADF5;
border-bottom: 1px solid #6EADF5;
background-color: #D2E6FD;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#E9EFF5), to(#E2EEFB));
background: -moz-linear-gradient(center top , #E9EFF5 0%, #E2EEFB 100%);
}
#story_titles .NB-story-titles-end-stories-line {
@ -2046,19 +2069,25 @@ background: transparent;
#story_pane .NB-feed-story-view-narrow .NB-feed-story-content {
margin-right: 28px;
}
#story_pane .NB-feed-story-content ins {
.NB-modal-preferences ins,
#story_pane .NB-feed-story-content ins,
.NB-pref-hide-changes #story_pane .NB-story-show-changes .NB-feed-story-content ins {
text-decoration: underline;
color: #27452D;
color: #27652F;
}
#story_pane .NB-feed-story-content del {
.NB-modal-preferences del,
#story_pane .NB-feed-story-content del,
.NB-pref-hide-changes #story_pane .NB-story-show-changes .NB-feed-story-content del {
display: inline;
color: #661616;
color: #861616;
}
.NB-pref-hide-changes #story_pane .NB-feed-story-content ins {
.NB-pref-hide-changes #story_pane .NB-feed-story-content ins,
#story_pane .NB-story-hide-changes .NB-feed-story-content ins {
text-decoration: none;
color: inherit;
}
.NB-pref-hide-changes #story_pane .NB-feed-story-content del {
.NB-pref-hide-changes #story_pane .NB-feed-story-content del,
#story_pane .NB-story-hide-changes .NB-feed-story-content del {
display: none;
}
#story_pane .NB-feed-story-comments {
@ -8636,3 +8665,32 @@ form.opml_import_form input {
.NB-interaction-sharedstory-content {
cursor: pointer;
}
/* ================= */
/* = Feed Selector = */
/* ================= */
.NB-feeds-selector {
display: none;
background-color: #434343;
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#434343), to(#696969));
background: -moz-linear-gradient(center top , #4E4E4E 0%, #696969 100%);
border-bottom: 1px solid #E9E9E9;
overflow: hidden;
}
.NB-feeds-selector-input {
border-radius: 16px;
border: 1px solid #5F5F5F;
font-weight: bold;
width: 88%;
padding: 1px 8px;
margin: 4px auto;
display: block;
font-size: 11px;
outline: none;
}
.NB-feeds-selector-input:focus {
border: 1px solid #5F5F5F;
box-shadow: 0 1px 0 #B1B1B1;
}

View file

@ -32,10 +32,8 @@ NEWSBLUR.Models.Story = Backbone.Model.extend({
},
has_modifications: function() {
if (this.get('story_content').indexOf('<ins') != -1) {
return true;
} else if (NEWSBLUR.assets.preference('hide_story_changes') &&
this.get('story_content').indexOf('<del') != -1) {
if (this.get('story_content').indexOf('<ins') != -1 ||
this.get('story_content').indexOf('<del') != -1) {
return true;
}
return false;

View file

@ -110,6 +110,7 @@
NEWSBLUR.app.story_list = new NEWSBLUR.Views.StoryListView({collection: NEWSBLUR.assets.stories});
NEWSBLUR.app.original_tab_view = new NEWSBLUR.Views.OriginalTabView({collection: NEWSBLUR.assets.stories});
NEWSBLUR.app.story_tab_view = new NEWSBLUR.Views.StoryTabView({collection: NEWSBLUR.assets.stories});
NEWSBLUR.app.feed_selector = new NEWSBLUR.Views.FeedSelector();
this.load_intelligence_slider();
this.handle_mouse_indicator_hover();
@ -615,8 +616,9 @@
var $current_feed = $current_feed || $('.selected', $feed_list);
var $next_feed,
scroll;
var $feeds = $('.feed:visible:not(.NB-empty)', $feed_list).add('.NB-feedlists .feed.NB-selected');
var $feeds = $('.feed:visible:not(.NB-empty)', $feed_list);
if (!$current_feed.length) {
$feeds = $feeds.add('.NB-feedlists .feed.NB-selected');
$current_feed = $('.feed:visible:not(.NB-empty)', $feed_list)[direction==1?'first':'last']();
$next_feed = $current_feed;
} else {
@ -1043,6 +1045,7 @@
this.active_story = null;
NEWSBLUR.assets.stories.reset();
NEWSBLUR.app.feed_selector.hide_feed_selector();
},
open_feed: function(feed_id, options) {
@ -1740,6 +1743,17 @@
}
},
mark_active_story_read: function() {
if (!this.active_story) return;
var story_id = this.active_story.id;
var story = this.model.get_story(story_id);
if (this.active_story && !this.active_story.get('read_status')) {
NEWSBLUR.assets.stories.mark_read(story, {skip_delay: true});
} else if (this.active_story && this.active_story.get('read_status')) {
NEWSBLUR.assets.stories.mark_unread(story);
}
},
mark_feed_as_read: function(feed_id) {
feed_id = feed_id || this.active_feed;
@ -5378,14 +5392,15 @@
});
$document.bind('keydown', 'u', function(e) {
e.preventDefault();
if (!self.active_story) return;
var story_id = self.active_story.id;
var story = self.model.get_story(story_id);
if (self.active_story && !self.active_story.get('read_status')) {
NEWSBLUR.assets.stories.mark_read(story, {skip_delay: true});
} else if (self.active_story && self.active_story.get('read_status')) {
NEWSBLUR.assets.stories.mark_unread(story);
}
self.mark_active_story_read();
});
$document.bind('keydown', 'm', function(e) {
e.preventDefault();
self.mark_active_story_read();
});
$document.bind('keydown', 'g', function(e) {
e.preventDefault();
NEWSBLUR.app.feed_selector.toggle();
});
$document.bind('keydown', 'shift+s', function(e) {
e.preventDefault();

View file

@ -0,0 +1,154 @@
NEWSBLUR.Views.FeedSelector = Backbone.View.extend({
el: '.NB-feeds-selector',
flags: {},
events: {
"keyup .NB-feeds-selector-input" : "keyup",
"keydown .NB-feeds-selector-input" : "keydown"
},
selected_index: 0,
initialize: function() {
this.selected_feeds = new NEWSBLUR.Collections.Feeds();
},
toggle: function() {
if (this.flags.showing_feed_selector) {
this.hide_feed_selector();
} else {
this.show_feed_selector();
}
},
show_feed_selector: function() {
var $input = this.$(".NB-feeds-selector-input");
var $feed_list = NEWSBLUR.reader.$s.$feed_list;
var $social_feeds = NEWSBLUR.reader.$s.$social_feeds;
this.$el.show();
$input.val('');
$input.focus();
$feed_list.addClass('NB-selector-active');
$social_feeds.addClass('NB-selector-active');
this.flags.showing_feed_selector = true;
NEWSBLUR.reader.layout.leftLayout.sizePane('north');
},
hide_feed_selector: function() {
if (!this.flags.showing_feed_selector) return;
var $input = this.$(".NB-feeds-selector-input");
var $feed_list = NEWSBLUR.reader.$s.$feed_list;
var $social_feeds = NEWSBLUR.reader.$s.$social_feeds;
$input.blur();
this.$el.hide();
this.$next_feed = null;
$feed_list.removeClass('NB-selector-active');
$social_feeds.removeClass('NB-selector-active');
$('.NB-feed-selector-selected').removeClass('NB-feed-selector-selected');
this.flags.showing_feed_selector = false;
NEWSBLUR.reader.layout.leftLayout.sizePane('north');
},
filter_feed_selector: function(e) {
var $input = this.$(".NB-feeds-selector-input");
var input = $input.val().toLowerCase();
if (input == this.last_input) return;
this.last_input = input;
this.selected_feeds.each(function(feed) {
_.each(feed.views, function(view) {
view.$el.removeClass('NB-feed-selector-active');
});
});
var filter_fn = function(feed){
return _.string.contains(feed.get('feed_title').toLowerCase(), input);
};
var feeds = NEWSBLUR.assets.feeds.filter(filter_fn);
var socialsubs = NEWSBLUR.assets.social_feeds.filter(filter_fn);
feeds = socialsubs.concat(feeds);
// Clear out shown feeds on empty input
if (input.length == 0) {
this.selected_feeds.reset();
}
if (feeds.length) {
this.selected_feeds.reset(feeds);
}
this.selected_feeds.each(function(feed) {
_.each(feed.views, function(view) {
view.$el.addClass('NB-feed-selector-active');
});
});
this.select(0);
},
// ==============
// = Navigation =
// ==============
keyup: function(e) {
var arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13};
if (e.which == arrow.up || e.which == arrow.down) {
// return this.navigate(e);
} else if (e.which == arrow.enter) {
// return this.open(e);
}
return this.filter_feed_selector(e);
},
keydown: function(e) {
var arrow = {left: 37, up: 38, right: 39, down: 40, enter: 13};
if (e.which == arrow.up || e.which == arrow.down) {
return this.navigate(e);
} else if (e.which == arrow.enter) {
return this.open(e);
}
// return this.filter_feed_selector(e);
},
navigate: function(e) {
var arrow = {left: 37, up: 38, right: 39, down: 40};
if (e.which == arrow.down) {
this.select(1);
} else if (e.which == arrow.up) {
this.select(-1);
}
e.preventDefault();
return false;
},
select: function(direction) {
var off, on;
var $current_feed = $('.NB-feed-selector-selected.NB-feed-selector-active');
this.$next_feed = NEWSBLUR.reader.get_next_feed(direction, $current_feed);
$('.NB-feed-selector-selected').removeClass('NB-feed-selector-selected');
this.$next_feed.addClass('NB-feed-selector-selected');
},
open: function(e) {
NEWSBLUR.reader.open_feed(this.$next_feed.data('id'), this.$next_feed);
e.preventDefault();
return false;
}
});

View file

@ -407,11 +407,13 @@ NEWSBLUR.Views.StoryDetailView = Backbone.View.extend({
var $button = this.$('.NB-feed-story-hide-changes');
if (NEWSBLUR.assets.preference('hide_story_changes')) {
this.$('ins').css({'text-decoration': 'underline'});
this.$('del').css({'display': 'inline'});
this.$el.addClass('NB-story-show-changes');
// this.$('ins').css({'text-decoration': 'underline'});
// this.$('del').css({'display': 'inline'});
} else {
this.$('ins').css({'text-decoration': 'none'});
this.$('del').css({'display': 'none'});
this.$el.addClass('NB-story-hide-changes');
// this.$('ins').css({'text-decoration': 'none'});
// this.$('del').css({'display': 'none'});
}
$button.css('opacity', 1).fadeOut(400);
$button.tipsy('hide').tipsy('disable');

View file

@ -5,6 +5,9 @@
<div class="left-north">
<div class="NB-feeds-header-dashboard"></div>
<div class="NB-feeds-selector">
<input type="text" name="feeds_selector" class="NB-feeds-selector-input" />
</div>
</div>
<div class="left-center">