mirror of
https://github.com/discourse/discourse.git
synced 2025-02-11 06:58:46 +08:00
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
import DiscourseURL from "discourse/lib/url";
|
|
|
|
export default Ember.Controller.extend({
|
|
discoveryTopics: Ember.inject.controller("discovery/topics"),
|
|
navigationCategory: Ember.inject.controller("navigation/category"),
|
|
application: Ember.inject.controller(),
|
|
|
|
loading: false,
|
|
|
|
category: Em.computed.alias("navigationCategory.category"),
|
|
noSubcategories: Em.computed.alias("navigationCategory.noSubcategories"),
|
|
|
|
loadedAllItems: Em.computed.not("discoveryTopics.model.canLoadMore"),
|
|
|
|
_showFooter: function() {
|
|
this.set("application.showFooter", this.get("loadedAllItems"));
|
|
}.observes("loadedAllItems"),
|
|
|
|
showMoreUrl(period) {
|
|
let url = "",
|
|
category = this.get("category");
|
|
if (category) {
|
|
url =
|
|
"/c/" +
|
|
Discourse.Category.slugFor(category) +
|
|
(this.get("noSubcategories") ? "/none" : "") +
|
|
"/l";
|
|
}
|
|
url += "/top/" + period;
|
|
return url;
|
|
},
|
|
|
|
actions: {
|
|
changePeriod(p) {
|
|
DiscourseURL.routeTo(this.showMoreUrl(p));
|
|
}
|
|
}
|
|
});
|