BUGFIX: navigation bar should always activate the right tab (even when diging into a top period) BUGFIX: /top pages titles BUGFIX: no "edit category" button on /top page after visiting a category BUGFIX: properly hide category columns when there is no children category (on both filter + top pages) BUGFIX: promises not caught when scrolling down a topic list to load more of them BUGFIX: CSS on category dropdowns Updated `top_menu` i18n with available filters
41 lines
1.5 KiB
JavaScript
41 lines
1.5 KiB
JavaScript
/**
|
|
The controller for discoverying "Top" topics
|
|
|
|
@class DiscoveryTopController
|
|
@extends Discourse.Controller
|
|
@namespace Discourse
|
|
@module Discourse
|
|
**/
|
|
Discourse.DiscoveryTopController = Discourse.ObjectController.extend({
|
|
category: null,
|
|
|
|
redirectedToTopPageReason: function() {
|
|
// no need for a reason if the default homepage is "top"
|
|
if (Discourse.Utilities.defaultHomepage() === "top") { return null; }
|
|
// check if the user is authenticated
|
|
if (Discourse.User.current()) {
|
|
if (Discourse.User.currentProp("trust_level") === 0) {
|
|
return I18n.t("filters.top.redirect_reasons.new_user");
|
|
} else if (!Discourse.User.currentProp("hasBeenSeenInTheLastMonth")) {
|
|
return I18n.t("filters.top.redirect_reasons.not_seen_in_a_month");
|
|
}
|
|
}
|
|
// no reason detected
|
|
return null;
|
|
}.property(),
|
|
|
|
hasDisplayedAllTopLists: Em.computed.and('content.yearly', 'content.monthly', 'content.weekly', 'content.daily'),
|
|
|
|
showMoreUrl: function(period) {
|
|
var url = "", category = this.get("category");
|
|
if (category) { url += category.get("url") + "/l"; }
|
|
url += "/top/" + period;
|
|
return url;
|
|
},
|
|
|
|
showMoreDailyUrl: function() { return this.showMoreUrl("daily"); }.property("category.url"),
|
|
showMoreWeeklyUrl: function() { return this.showMoreUrl("weekly"); }.property("category.url"),
|
|
showMoreMonthlyUrl: function() { return this.showMoreUrl("monthly"); }.property("category.url"),
|
|
showMoreYearlyUrl: function() { return this.showMoreUrl("yearly"); }.property("category.url"),
|
|
});
|