mirror of
https://github.com/samuelclay/NewsBlur.git
synced 2025-08-05 16:58:59 +00:00
Updating starred count on load.
This commit is contained in:
parent
82dd89b161
commit
822ad26c63
5 changed files with 62 additions and 17 deletions
|
@ -163,8 +163,14 @@ def load_feeds(request):
|
|||
for f in feeds:
|
||||
if 'not_yet_fetched' not in feeds[f]:
|
||||
feeds[f]['not_yet_fetched'] = False
|
||||
|
||||
data = dict(feeds=feeds, folders=json.decode(folders.folders))
|
||||
|
||||
starred_count = MStarredStory.objects(user_id=request.user.pk).count()
|
||||
|
||||
data = {
|
||||
'feeds': feeds,
|
||||
'folders': json.decode(folders.folders),
|
||||
'starred_count': starred_count,
|
||||
}
|
||||
return data
|
||||
|
||||
@ajax_login_required
|
||||
|
|
|
@ -1407,7 +1407,19 @@ background: transparent;
|
|||
/* = Header - Starred Stories = */
|
||||
/* ============================ */
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred {
|
||||
.NB-feeds-header-starred-container {
|
||||
position: relative;
|
||||
height: 20px;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.NB-feeds-header-starred {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 18px;
|
||||
border-top: 1px solid #303030;
|
||||
border-bottom: 1px solid #E9E9E9;
|
||||
padding-right: 2px;
|
||||
|
@ -1416,22 +1428,22 @@ background: transparent;
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred.NB-selected {
|
||||
.NB-feeds-header-starred.NB-selected {
|
||||
background: #f6a828 url('../theme/images/ui-bg_highlight-hard_35_f6a828_1x100.png') 0 50% repeat-x;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred .NB-feeds-header-starred-icon {
|
||||
.NB-feeds-header-starred .NB-feeds-header-starred-icon {
|
||||
position: absolute;
|
||||
top: 2px;
|
||||
top: 1px;
|
||||
left: 2px;
|
||||
background: transparent url('../img/reader/star_blue.png') no-repeat 0 0;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred .NB-feeds-header-starred-title {
|
||||
.NB-feeds-header-starred .NB-feeds-header-starred-title {
|
||||
display: block;
|
||||
padding: 4px 40px 2px 23px;
|
||||
padding: 3px 40px 2px 23px;
|
||||
text-decoration: none;
|
||||
color: #F0F0F0;
|
||||
line-height: 1.3em;
|
||||
|
@ -1441,19 +1453,24 @@ background: transparent;
|
|||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred:hover .NB-feeds-header-starred-title {
|
||||
.NB-feeds-header-starred:hover .NB-feeds-header-starred-title {
|
||||
color: #DCDCDC;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred.NB-selected .NB-feeds-header-starred-title {
|
||||
.NB-feeds-header-starred.NB-selected .NB-feeds-header-starred-title {
|
||||
text-shadow: 0 1px 0 #FFC97D;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.NB-feeds-header-container .NB-feeds-header-starred-count {
|
||||
.NB-feeds-header-starred .NB-feeds-header-starred-count {
|
||||
background-color: #11448B;
|
||||
display: block;
|
||||
padding: 0 4px;
|
||||
margin-top: 2px;
|
||||
}
|
||||
|
||||
.NB-feeds-header-starred.NB-empty .NB-feeds-header-starred-count {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ============ */
|
||||
|
|
|
@ -22,6 +22,7 @@ NEWSBLUR.AssetModel.Reader = function() {
|
|||
this.read_stories = {};
|
||||
this.classifiers = {};
|
||||
this.starred_stories = [];
|
||||
this.starred_count = 0;
|
||||
|
||||
this.DEFAULT_VIEW = NEWSBLUR.Preferences.default_view || 'page';
|
||||
};
|
||||
|
@ -169,6 +170,7 @@ NEWSBLUR.AssetModel.Reader.prototype = {
|
|||
}
|
||||
});
|
||||
self.folders = subscriptions.folders;
|
||||
self.starred_count = subscriptions.starred_count;
|
||||
callback();
|
||||
};
|
||||
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
$mouse_indicator: $('#mouse-indicator'),
|
||||
$feed_link_loader: $('#NB-feeds-list-loader'),
|
||||
$feeds_progress: $('#NB-progress'),
|
||||
$header: $(".NB-feeds-header")
|
||||
$header: $('.NB-feeds-header'),
|
||||
$starred_header: $('.NB-feeds-header-starred')
|
||||
};
|
||||
this.flags = {
|
||||
'feed_view_images_loaded': {},
|
||||
|
@ -618,6 +619,7 @@
|
|||
$('.feed', $feed_list).tsort('.feed_title');
|
||||
$('.folder', $feed_list).tsort('.folder_title_text');
|
||||
this.update_header_counts();
|
||||
_.delay(_.bind(this.update_starred_count, this), 250);
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -646,6 +648,22 @@
|
|||
});
|
||||
},
|
||||
|
||||
update_starred_count: function() {
|
||||
var starred_count = this.model.starred_count;
|
||||
var $starred_count = $('.NB-feeds-header-starred-count', this.$s.$starred_header);
|
||||
var $starred_container = this.$s.$starred_header.closest('.NB-feeds-header-starred-container');
|
||||
|
||||
if (starred_count <= 0) {
|
||||
this.$s.$starred_header.addClass('NB-empty');
|
||||
$starred_count.text('');
|
||||
$starred_container.slideUp(350);
|
||||
} else if (starred_count > 0) {
|
||||
$starred_count.text(starred_count);
|
||||
this.$s.$starred_header.removeClass('NB-empty');
|
||||
$starred_container.slideDown(350);
|
||||
}
|
||||
},
|
||||
|
||||
detect_all_inactive_feeds: function() {
|
||||
var feeds = this.model.feeds;
|
||||
var has_chosen_feeds = _.any(feeds, function(feed) {
|
||||
|
|
|
@ -330,11 +330,13 @@ $(document).ready(function() {
|
|||
</div>
|
||||
<div class="NB-feeds-header-home">Dashboard</div>
|
||||
</div>
|
||||
<div class="NB-feeds-header-starred">
|
||||
<div class="NB-feeds-header-starred-count unread_count">4</div>
|
||||
<div class="NB-feeds-header-starred-icon"></div>
|
||||
<div class="NB-feeds-header-starred-title">
|
||||
Starred Stories
|
||||
<div class="NB-feeds-header-starred-container">
|
||||
<div class="NB-feeds-header-starred NB-empty">
|
||||
<div class="NB-feeds-header-starred-count unread_count"></div>
|
||||
<div class="NB-feeds-header-starred-icon"></div>
|
||||
<div class="NB-feeds-header-starred-title">
|
||||
Starred Stories
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue