FIX: always show filtered site settings
This commit is contained in:
parent
59cb907f25
commit
c9279a118e
|
@ -4,7 +4,7 @@ export default Ember.Controller.extend({
|
|||
categoryNameKey: null,
|
||||
adminSiteSettings: Ember.inject.controller(),
|
||||
|
||||
@computed("adminSiteSettings.model", "categoryNameKey")
|
||||
@computed("adminSiteSettings.visible", "categoryNameKey")
|
||||
category(categories, nameKey) {
|
||||
return (categories || []).findBy("nameKey", nameKey);
|
||||
},
|
||||
|
|
|
@ -2,6 +2,8 @@ import debounce from "discourse/lib/debounce";
|
|||
|
||||
export default Ember.Controller.extend({
|
||||
filter: null,
|
||||
allSiteSettings: Ember.computed.alias("model"),
|
||||
visible: null,
|
||||
onlyOverridden: false,
|
||||
|
||||
filterContentNow(category) {
|
||||
|
@ -14,7 +16,7 @@ export default Ember.Controller.extend({
|
|||
}
|
||||
|
||||
if ((!filter || 0 === filter.length) && !this.get("onlyOverridden")) {
|
||||
this.set("model", this.get("allSiteSettings"));
|
||||
this.set("visible", this.get("allSiteSettings"));
|
||||
this.transitionToRoute("adminSiteSettings");
|
||||
return;
|
||||
}
|
||||
|
@ -62,7 +64,7 @@ export default Ember.Controller.extend({
|
|||
all.hasMore = matches.length > 30;
|
||||
all.count = all.hasMore ? "30+" : matches.length;
|
||||
|
||||
this.set("model", matchesGroupedByCategory);
|
||||
this.set("visible", matchesGroupedByCategory);
|
||||
this.transitionToRoute(
|
||||
"adminSiteSettingsCategory",
|
||||
category || "all_results"
|
||||
|
|
|
@ -6,7 +6,7 @@ export default Discourse.Route.extend({
|
|||
beforeModel() {
|
||||
this.replaceWith(
|
||||
"adminSiteSettingsCategory",
|
||||
this.modelFor("adminSiteSettings")[0].nameKey
|
||||
this.controllerFor("adminSiteSettings").get("visible")[0].nameKey
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -10,9 +10,10 @@ export default Discourse.Route.extend({
|
|||
},
|
||||
|
||||
afterModel(siteSettings) {
|
||||
this.controllerFor("adminSiteSettings").set(
|
||||
"allSiteSettings",
|
||||
siteSettings
|
||||
);
|
||||
const controller = this.controllerFor("adminSiteSettings");
|
||||
|
||||
if (!controller.get("visible")) {
|
||||
controller.set("visible", siteSettings);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="admin-nav pull-left">
|
||||
<ul class="nav nav-stacked">
|
||||
{{#each model as |category|}}
|
||||
{{#each visible as |category|}}
|
||||
<li class="{{category.nameKey}}">
|
||||
{{#link-to 'adminSiteSettingsCategory' category.nameKey class=category.nameKey}}
|
||||
{{category.name}}
|
||||
|
|
|
@ -54,3 +54,20 @@ QUnit.test("changing value updates dirty state", async assert => {
|
|||
"saving via Enter key marks setting as overriden"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test(
|
||||
"always shows filtered site settings if a filter is set",
|
||||
async assert => {
|
||||
await visit("/admin/site_settings");
|
||||
await fillIn("#setting-filter", "title");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
|
||||
// navigate away to the "Dashboard" page
|
||||
await click(".nav.nav-pills li:nth-child(1) a");
|
||||
assert.equal(count(".row.setting"), 0);
|
||||
|
||||
// navigate back to the "Settings" page
|
||||
await click(".nav.nav-pills li:nth-child(2) a");
|
||||
assert.equal(count(".row.setting"), 1);
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue