FEATURE: merge new and old unread counts on categories page

UI: restyle UI to match counts
This commit is contained in:
Sam 2014-08-05 10:44:01 +10:00
parent 0d154ecf7b
commit ef5b18779e
5 changed files with 32 additions and 10 deletions

View File

@ -62,6 +62,11 @@ Discourse.Topic = Discourse.Model.extend({
return url;
},
totalUnread: function() {
var count = (this.get('unread') || 0) + (this.get('new_posts') || 0);
return count > 0 ? count : null;
}.property('new_posts', 'unread'),
lastReadUrl: function() {
return this.urlForPostNumber(this.get('last_read_post_number'));
}.property('url', 'last_read_post_number'),

View File

@ -22,7 +22,7 @@
{{#if controller.ordering}}<i class="fa fa-bars"></i>{{/if}}
{{category-title-link category=this}}
{{#if unreadTopics}}
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{unbound unreadTopics}} {{i18n topic.unread}}</a>
<a href={{unbound unreadUrl}} class='badge new-posts badge-notification' title='{{i18n topic.unread_topics count="unreadTopics"}}'>{{i18n filters.unread.lower_title_with_count count="unreadTopics"}}</a>
{{/if}}
{{#if newTopics}}
<a href={{unbound newUrl}} class='badge new-posts badge-notification' title='{{i18n topic.new_topics count="newTopics"}}'>{{i18n filters.new.lower_title_with_count count="newTopics"}}</a>
@ -54,11 +54,8 @@
<div class="featured-topic">
{{topic-status topic=this}}
<a class='title' href="{{unbound lastUnreadUrl}}">{{{unbound fancy_title}}}</a>
{{#if unread}}
<a href="{{unbound lastUnreadUrl}}" class='badge unread badge-notification' title='{{i18n topic.unread_posts count="unread"}}'>{{unread}}</a>
{{/if}}
{{#if new_posts}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new_posts count="new_posts"}}'>{{new_posts}}</a>
{{#if totalUnread}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.total_unread_posts count="totalUnread"}}'>{{totalUnread}}</a>
{{/if}}
{{#if unseen}}
<a href="{{unbound lastUnreadUrl}}" class='badge new-posts badge-notification' title='{{i18n topic.new}}'>{{i18n filters.new.lower_title}}</a>

View File

@ -97,9 +97,14 @@
.topic-list.categories {
.new-posts.badge-notification {
.category .badge-notification {
background-color:transparent;
color: scale-color($primary, $lightness: 50%);
position: inherit;
}
.subcategories .badge {
display: none;
}
td.category {

View File

@ -155,7 +155,10 @@
}
.topic-list.categories {
a.title {color: $tertiary;}
a.title {
color: $tertiary;
font-size: 12px;
}
a.title:visited:not(.badge-notification) {color: scale-color($tertiary, $lightness: 35%);}
th.posts {
@ -228,7 +231,8 @@
}
.featured-topic {
margin: 6px 0;
margin: 10px 0 0;
font-size: 12px;
/* topic status glyphs */
i {
color: scale-color($primary, $lightness: 50%) !important;
@ -236,9 +240,13 @@
a.last-posted-at, a.last-posted-at:visited {
color: scale-color($primary, $lightness: 50%);
}
.badge {
font-size: 9px;
top: -1px;
}
}
.badge-category {
.category .badge-category {
display: inline-block;
margin-top: 1px;
}

View File

@ -771,6 +771,9 @@ en:
not_found:
title: "Topic not found"
description: "Sorry, we couldn't find that topic. Perhaps it was removed by a moderator?"
total_unread_posts:
one: "you have 1 unread post in this topic"
other: "you have {{count}} unread posts in this topic"
unread_posts:
one: "you have 1 unread old post in this topic"
other: "you have {{count}} unread old posts in this topic"
@ -1319,6 +1322,10 @@ en:
one: "Unread (1)"
other: "Unread ({{count}})"
help: "topics you are currently watching or tracking with unread posts"
lower_title_with_count:
zero: ""
one: "1 unread"
other: "{{count}} unread"
new:
lower_title_with_count:
zero: ""