Skip to content

Commit

Permalink
FEATURE: on mobile display a rollup of unread and new on latest
Browse files Browse the repository at this point in the history
  • Loading branch information
SamSaffron committed Jun 23, 2015
1 parent 13f1f90 commit f101408
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
8 changes: 7 additions & 1 deletion app/assets/javascripts/discourse/models/nav_item.js
Expand Up @@ -12,7 +12,13 @@ Discourse.NavItem = Discourse.Model.extend({
displayName: function() {
var categoryName = this.get('categoryName'),
name = this.get('name'),
extra = { count: this.get('count') || 0 };
count = this.get('count') || 0;

if (name === 'latest' && !Discourse.Mobile.mobileView) {
count = 0;
}

var extra = { count: count };

if (categoryName) {
name = 'category';
Expand Down
Expand Up @@ -266,6 +266,12 @@ const TopicTrackingState = Discourse.Model.extend({
},

lookupCount(name, category){

if (name === "latest") {
return this.lookupCount("new", category) +
this.lookupCount("unread", category);
}

let categoryName = category ? Em.get(category, "name") : null;
if(name === "new") {
return this.countNew(categoryName);
Expand All @@ -278,6 +284,7 @@ const TopicTrackingState = Discourse.Model.extend({
}
}
},

loadStates(data) {
// not exposed
const states = this.states;
Expand Down
5 changes: 4 additions & 1 deletion config/locales/client.en.yml
Expand Up @@ -1567,7 +1567,10 @@ en:
with_topics: "%{filter} topics"
with_category: "%{filter} %{category} topics"
latest:
title: "Latest"
title:
zero: "Latest"
one: "Latest (1)"
other: "Latest ({{count}})"
help: "topics with recent posts"
hot:
title: "Hot"
Expand Down

0 comments on commit f101408

Please sign in to comment.