diff --git a/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 b/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 index 52b7cb6d8ba..b2eb1335ed8 100644 --- a/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-plugins.js.es6 @@ -1,6 +1,10 @@ export default Ember.ArrayController.extend({ adminRoutes: function() { - return this.get('model').map(p => p.admin_route).compact(); + return this.get('model').map(function(p) { + if (p.get('enabled')) { + return p.admin_route; + } + }).compact(); }.property() }); diff --git a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 index ae97f0f0f2e..0d617ee1a68 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 @@ -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: { diff --git a/app/assets/javascripts/admin/routes/admin-plugins.js.es6 b/app/assets/javascripts/admin/routes/admin-plugins.js.es6 index ae7f961fd10..f1092e5000a 100644 --- a/app/assets/javascripts/admin/routes/admin-plugins.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-plugins.js.es6 @@ -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'); + } + } + }); } } }); diff --git a/app/assets/javascripts/admin/templates/plugins-index.hbs b/app/assets/javascripts/admin/templates/plugins-index.hbs index 1bbdf5e7d91..95b979de4a2 100644 --- a/app/assets/javascripts/admin/templates/plugins-index.hbs +++ b/app/assets/javascripts/admin/templates/plugins-index.hbs @@ -9,11 +9,13 @@
- +
+ + @@ -27,6 +29,25 @@ {{/if}} + + {{/each}} diff --git a/app/assets/stylesheets/common/admin/admin_base.scss b/app/assets/stylesheets/common/admin/admin_base.scss index 61980809a8d..e5f52fc09ed 100644 --- a/app/assets/stylesheets/common/admin/admin_base.scss +++ b/app/assets/stylesheets/common/admin/admin_base.scss @@ -1240,6 +1240,10 @@ table.api-keys { } } +.admin-plugins .col-enabled { + width: 20px; +} + // Backups // -------------------------------------------------- diff --git a/app/serializers/admin_plugin_serializer.rb b/app/serializers/admin_plugin_serializer.rb index 09fdcc52768..6a00ded3745 100644 --- a/app/serializers/admin_plugin_serializer.rb +++ b/app/serializers/admin_plugin_serializer.rb @@ -3,7 +3,9 @@ class AdminPluginSerializer < ApplicationSerializer :name, :version, :url, - :admin_route + :admin_route, + :enabled, + :enabled_setting def id object.metadata.name @@ -21,6 +23,18 @@ class AdminPluginSerializer < ApplicationSerializer object.metadata.url end + def enabled + object.enabled? + end + + def enabled_setting + object.enabled_site_setting + end + + def include_enabled_setting? + enabled_setting.present? + end + def include_url? url.present? end diff --git a/config/locales/client.en.yml b/config/locales/client.en.yml index ee11a3ca180..e811f428ad1 100644 --- a/config/locales/client.en.yml +++ b/config/locales/client.en.yml @@ -1825,7 +1825,12 @@ en: name: "Name" none_installed: "You don't have any plugins installed." version: "Version" + enabled: "Enabled?" + is_enabled: "Y" + not_enabled: "N" + cant_disable: "-" change_settings: "Change Settings" + change_settings_short: "Settings" howto: "How do I install plugins?" backups: diff --git a/lib/plugin/instance.rb b/lib/plugin/instance.rb index 99e978f9b98..b0f7c37db10 100644 --- a/lib/plugin/instance.rb +++ b/lib/plugin/instance.rb @@ -299,8 +299,12 @@ class Plugin::Instance end end - def enabled_site_setting(setting) - @enabled_site_setting = setting + def enabled_site_setting(setting=nil) + if setting + @enabled_site_setting = setting + else + @enabled_site_setting + end end protected diff --git a/plugins/poll/plugin.rb b/plugins/poll/plugin.rb index 5147e7f0723..34e71188b27 100644 --- a/plugins/poll/plugin.rb +++ b/plugins/poll/plugin.rb @@ -4,6 +4,8 @@ # authors: Vikhyat Korrapati (vikhyat), RĂ©gis Hanol (zogstrip) # url: https://github.com/discourse/discourse/tree/master/plugins/poll +enabled_site_setting :poll_enabled + register_asset "stylesheets/common/poll.scss" register_asset "stylesheets/desktop/poll.scss", :desktop register_asset "stylesheets/mobile/poll.scss", :mobile
{{i18n "admin.plugins.name"}} {{i18n "admin.plugins.version"}}{{i18n "admin.plugins.enabled"}}
{{plugin.version}} + {{#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}} + + {{#if plugin.enabled_setting}} + + {{/if}} +