FIX: site setting search

This commit is contained in:
Régis Hanol 2014-12-29 21:56:33 +01:00
parent a04f44d65a
commit 25e5031fb1
2 changed files with 6 additions and 13 deletions

View File

@ -28,6 +28,7 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
if ((filter === undefined || filter.length < 1) && !this.get('onlyOverridden')) {
this.set('model', this.get('allSiteSettings'));
this.transitionToRoute("adminSiteSettings");
return;
}
@ -50,20 +51,19 @@ export default Ember.ArrayController.extend(Discourse.Presence, {
});
if (matches.length > 0) {
matchesGroupedByCategory[0].siteSettings.pushObjects(matches);
matchesGroupedByCategory.pushObject({
nameKey: settingsCategory.nameKey,
name: settingsCategory.name,
siteSettings: matches});
}
});
this.set('model', matchesGroupedByCategory);
this.transitionToRoute("adminSiteSettingsCategory", "all_results");
}, 250).observes('filter', 'onlyOverridden'),
actions: {
clearFilter: function() {
this.set('filter', '');
this.set('onlyOverridden', false);
this.setProperties({
filter: '',
onlyOverridden: false
});
}
}

View File

@ -8,13 +8,6 @@
**/
Discourse.AdminSiteSettingsCategoryRoute = Discourse.Route.extend({
model: function(params) {
if (params.category_id === "all_results") {
var category = this.controllerFor('adminSiteSettings').get('content').findProperty('nameKey', 'all_results');
if (!category || !category.siteSettings.length) {
this.replaceWith('adminSiteSettings.index');
return;
}
}
// The model depends on user input, so let the controller do the work:
this.controllerFor('adminSiteSettingsCategory').set('categoryNameKey', params.category_id);
return Em.Object.create({