mirror of
https://github.com/discourse/discourse.git
synced 2025-05-25 19:29:34 +08:00
UX: Observe changes to plugin to hide/show plugin admin link without refresh.
This commit is contained in:
@ -1,9 +1,16 @@
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
adminRoutes: function() {
|
||||
return this.get('model').map(p => {
|
||||
if (p.get('enabled')) {
|
||||
return p.admin_route;
|
||||
@computed('model.@each.enabled_setting')
|
||||
adminRoutes() {
|
||||
let routes = []
|
||||
|
||||
this.get('model').forEach(p => {
|
||||
if (this.siteSettings[p.get('enabled_setting')] && p.get('admin_route')) {
|
||||
routes.push(p.get('admin_route'));
|
||||
}
|
||||
}).compact();
|
||||
}.property()
|
||||
});
|
||||
|
||||
return routes;
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user