FEATURE: Per-plugin settings buttons, "Enabled" column
Also, added enabled_site_setting to the Poll plugin so it shows up properly.
This commit is contained in:
@@ -5,8 +5,7 @@ export default Ember.ArrayController.extend(Presence, {
|
||||
onlyOverridden: false,
|
||||
filtered: Ember.computed.notEmpty('filter'),
|
||||
|
||||
filterContent: Discourse.debounce(function() {
|
||||
|
||||
filterContentNow: function(category) {
|
||||
// If we have no content, don't bother filtering anything
|
||||
if (!this.present('allSiteSettings')) return;
|
||||
|
||||
@@ -48,7 +47,15 @@ export default Ember.ArrayController.extend(Presence, {
|
||||
});
|
||||
|
||||
this.set('model', matchesGroupedByCategory);
|
||||
this.transitionToRoute("adminSiteSettingsCategory", "all_results");
|
||||
return this.transitionToRoute("adminSiteSettingsCategory", category || "all_results");
|
||||
},
|
||||
|
||||
filterContent: Discourse.debounce(function() {
|
||||
if (this.get("_skipBounce")) {
|
||||
this.set("_skipBounce", false);
|
||||
} else {
|
||||
this.filterContentNow();
|
||||
}
|
||||
}, 250).observes('filter', 'onlyOverridden'),
|
||||
|
||||
actions: {
|
||||
|
||||
@@ -4,8 +4,21 @@ export default Ember.Route.extend({
|
||||
},
|
||||
|
||||
actions: {
|
||||
showSettings() {
|
||||
this.transitionTo('adminSiteSettingsCategory', 'plugins');
|
||||
showSettings(plugin) {
|
||||
const controller = this.controllerFor('adminSiteSettings');
|
||||
this.transitionTo('adminSiteSettingsCategory', 'plugins').then(function() {
|
||||
if (plugin) {
|
||||
const match = /^(.*)_enabled/.exec(plugin.get('enabled_setting'));
|
||||
if (match[1]) {
|
||||
// filterContent() is normally on a debounce from typing.
|
||||
// Because we don't want the default of "All Results", we tell it
|
||||
// to skip the next debounce.
|
||||
controller.set('filter', match[1]);
|
||||
controller.set('_skipBounce', true);
|
||||
controller.filterContentNow('plugins');
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -9,11 +9,13 @@
|
||||
|
||||
<br/>
|
||||
|
||||
<table>
|
||||
<table class="admin-plugins">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{i18n "admin.plugins.name"}}</th>
|
||||
<th>{{i18n "admin.plugins.version"}}</th>
|
||||
<th>{{i18n "admin.plugins.enabled"}}</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -27,6 +29,25 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>{{plugin.version}}</td>
|
||||
<td class="col-enabled">
|
||||
{{#if plugin.enabled_setting}}
|
||||
{{#if plugin.enabled}}
|
||||
{{i18n "admin.plugins.is_enabled"}}
|
||||
{{else}}
|
||||
{{i18n "admin.plugins.not_enabled"}}
|
||||
{{/if}}
|
||||
{{else}}
|
||||
{{i18n "admin.plugins.cant_disable"}}
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>
|
||||
{{#if plugin.enabled_setting}}
|
||||
<button {{action "showSettings" plugin}} class="btn">
|
||||
{{fa-icon "gear"}}
|
||||
{{i18n "admin.plugins.change_settings_short"}}
|
||||
</button>
|
||||
{{/if}}
|
||||
</td>
|
||||
</tr>
|
||||
{{/each}}
|
||||
</tbody>
|
||||
|
||||
Reference in New Issue
Block a user