UX: Observe changes to plugin to hide/show plugin admin link without refresh.

This commit is contained in:
Guo Xiang Tan 2017-01-09 13:56:15 +08:00
parent e721e31699
commit fed7218deb
1 changed files with 13 additions and 6 deletions

View File

@ -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;
}
});