FEATURE: Add education text to new and unread pages when there are no results

This commit is contained in:
Neil Lalonde 2014-08-18 16:17:35 -04:00
parent f1486c7728
commit 0841cd2ba6
4 changed files with 42 additions and 14 deletions

View file

@ -145,6 +145,18 @@ var controllerOpts = {
}
}.property('allLoaded', 'topics.length'),
footerEducation: function() {
if (!this.get('allLoaded') || this.get('topics.length') > 0 || !Discourse.User.current()) { return; }
var split = this.get('filter').split('/');
if (split[0] !== 'new' && split[0] !== 'unread') { return; }
return I18n.t("topics.none.educate." + split[0], {
userPrefsUrl: Discourse.getURL("/users/") + (Discourse.User.currentProp("username_lower")) + "/preferences"
});
}.property('allLoaded', 'topics.length'),
loadMoreTopics: function() {
return this.get('model').loadMore();
}

View file

@ -91,21 +91,27 @@
<button class='btn dismiss-read' {{action resetNew}}>{{i18n topics.bulk.dismiss_new}}</button>
{{/if}}
<h3>
{{#if latest}}
{{#if latest}}
{{{footerEducation}}}
<h3>
{{footerMessage}}
{{#if can_create_topic}}<a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a>{{/if}}
{{else}}
{{#if top}}
</h3>
{{else}}
{{#if top}}
<h3>
{{#link-to "discovery.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}} {{i18n or}} {{i18n filters.top.other_periods}}
{{#unless yearly}}<a href="{{unbound showMoreYearlyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_year}}</a>{{/unless}}
{{#unless monthly}}<a href="{{unbound showMoreMonthlyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_month}}</a>{{/unless}}
{{#unless weekly}}<a href="{{unbound showMoreWeeklyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_week}}</a>{{/unless}}
{{#unless daily}}<a href="{{unbound showMoreDailyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.today}}</a>{{/unless}}
{{else}}
</h3>
{{else}}
{{{footerEducation}}}
<h3>
{{footerMessage}}{{#link-to "discovery.categories"}} {{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
{{/if}}
</h3>
{{/if}}
</h3>
{{/if}}
{{/if}}
</footer>

View file

@ -36,21 +36,28 @@
{{#if showResetNew}}
<button class='btn dismiss-read' {{action resetNew}}>{{i18n topics.bulk.dismiss_new}}</button>
{{/if}}
<h3>
{{#if latest}}
{{#if latest}}
{{{footerEducation}}}
<h3>
{{footerMessage}}
{{#if can_create_topic}}<a href='#' {{action createTopic}}>{{i18n topic.suggest_create_topic}}</a>{{/if}}
{{else}}
{{#if top}}
</h3>
{{else}}
{{#if top}}
<h3>
{{#link-to "discovery.categories"}}{{i18n topic.browse_all_categories}}{{/link-to}}, {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}} {{i18n or}} {{i18n filters.top.other_periods}}
{{#unless yearly}}<a href="{{unbound showMoreYearlyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_year}}</a>{{/unless}}
{{#unless monthly}}<a href="{{unbound showMoreMonthlyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_month}}</a>{{/unless}}
{{#unless weekly}}<a href="{{unbound showMoreWeeklyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.this_week}}</a>{{/unless}}
{{#unless daily}}<a href="{{unbound showMoreDailyUrl}}" class='btn'><i class="fa fa-calendar-o"></i>{{i18n filters.top.today}}</a>{{/unless}}
{{else}}
</h3>
{{else}}
{{{footerEducation}}}
<h3>
{{footerMessage}}{{#link-to "discovery.categories"}} {{i18n topic.browse_all_categories}}{{/link-to}} {{i18n or}} {{#link-to 'discovery.latest'}}{{i18n topic.view_latest_topics}}{{/link-to}}
{{/if}}
</h3>
{{/if}}
</h3>
{{/if}}
{{/if}}
</footer>

View file

@ -769,6 +769,9 @@ en:
hot: "There are no hot topics."
category: "There are no {{category}} topics."
top: "There are no top topics."
educate:
new: '<p>Your <a href="%{userPrefsUrl}">preferences</a> define which topics are considered new.</p>'
unread: "<p>You have read all of the posts in the topics you are tracking or watching.</p>"
bottom:
latest: "There are no more latest topics."
hot: "There are no more hot topics."