diff --git a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 index 6869f88f4ac..8bde80be306 100644 --- a/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 +++ b/app/assets/javascripts/discourse/controllers/discovery/topics.js.es6 @@ -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(); } diff --git a/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars b/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars index e7f620ed4a0..cee89c8b8aa 100644 --- a/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/discovery/topics.js.handlebars @@ -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> diff --git a/app/assets/javascripts/discourse/templates/mobile/discovery/topics.js.handlebars b/app/assets/javascripts/discourse/templates/mobile/discovery/topics.js.handlebars index ae08623ad3c..9864db826f5 100644 --- a/app/assets/javascripts/discourse/templates/mobile/discovery/topics.js.handlebars +++ b/app/assets/javascripts/discourse/templates/mobile/discovery/topics.js.handlebars @@ -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> diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index 257b1a42eed..d150f7f4665 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -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."