This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/controllers/discovery.js.es6
Régis Hanol 0947191060 UX: improved our footer handling
- new "show-footer" mixins
- converted most of the routes to ES6
- FIX: handling of "indexStream" in user pages

There will now be a footer on all the following pages
- /exception
- /about
- /latest
- /new
- /unread
- /starred
- /top
- /categories
- /c/:category
- /c/:category/l/latest
- /c/:category/l/new
- /c/:category/l/unread
- /c/:category/l/top
- /t/:topic/:id
- /groups/:name/members
- /user/activity
- /user/activity/topics
- /user/activity/posts
- /user/activity/replies
- /user/activity/likes-given
- /user/activity/likes-received
- /user/activity/bookmarks
- /user/activity/starred
- /user/badges
- /user/notifications
- /user/flagged-posts
- /user/deleted-posts
- /user/private-messages
- /user/private-messages/mine
- /user/private-messages/unread
- /user/invited
- /user/:username/preferences
- /faq (static pages)
- /badges
- /badges/:id/:badge
2014-11-19 20:37:43 +01:00

38 lines
1.3 KiB
JavaScript

import ObjectController from 'discourse/controllers/object';
import TopPeriod from 'discourse/models/top-period';
export default ObjectController.extend({
needs: ['navigation/category', 'discovery/topics', 'application'],
loading: false,
category: Em.computed.alias('controllers.navigation/category.category'),
noSubcategories: Em.computed.alias('controllers.navigation/category.noSubcategories'),
loadedAllItems: Em.computed.not("controllers.discovery/topics.canLoadMore"),
_showFooter: function() {
this.set("controllers.application.showFooter", this.get("loadedAllItems"));
}.observes("loadedAllItems"),
showMoreUrl: function(period) {
var url = '', category = this.get('category');
if (category) {
url = '/c/' + Discourse.Category.slugFor(category) + (this.get('noSubcategories') ? '/none' : '') + '/l';
}
url += '/top/' + period;
return url;
},
periods: function() {
var self = this,
periods = [];
Discourse.Site.currentProp('periods').forEach(function(p) {
periods.pushObject(TopPeriod.create({ id: p,
showMoreUrl: self.showMoreUrl(p),
periods: periods }));
});
return periods;
}.property('category', 'noSubcategories'),
});