discourse/app/assets/javascripts/admin/routes/admin-plugins.js.es6

28 lines
915 B
Plaintext
Raw Normal View History

export default Ember.Route.extend({
model() {
2018-06-15 23:03:24 +08:00
return this.store.findAll("plugin");
},
actions: {
showSettings(plugin) {
2018-06-15 23:03:24 +08:00
const controller = this.controllerFor("adminSiteSettings");
this.transitionTo("adminSiteSettingsCategory", "plugins").then(() => {
if (plugin) {
2018-06-15 23:03:24 +08:00
const siteSettingFilter = plugin.get("enabled_setting_filter");
const match = /^(.*)_enabled/.exec(plugin.get("enabled_setting"));
const filter = siteSettingFilter || match[1];
if (filter) {
// 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.
2018-06-15 23:03:24 +08:00
controller.set("filter", filter);
controller.set("_skipBounce", true);
controller.filterContentNow("plugins");
}
}
});
}
}
});