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 25420b562dd..9473cbccae5 100644 --- a/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-site-settings.js.es6 @@ -17,7 +17,9 @@ export default Ember.Controller.extend({ if ((!filter || 0 === filter.length) && !this.get("onlyOverridden")) { this.set("visibleSiteSettings", this.get("allSiteSettings")); - this.transitionToRoute("adminSiteSettings"); + if (this.get("categoryNameKey") === "all_results") { + this.transitionToRoute("adminSiteSettings"); + } return; } @@ -77,7 +79,7 @@ export default Ember.Controller.extend({ } else { this.filterContentNow(); } - }, 250).observes("filter", "onlyOverridden"), + }, 250).observes("filter", "onlyOverridden", "model"), actions: { clearFilter() { diff --git a/app/assets/javascripts/admin/mixins/setting-component.js.es6 b/app/assets/javascripts/admin/mixins/setting-component.js.es6 index c3f4f19e3d3..9f8166fbecf 100644 --- a/app/assets/javascripts/admin/mixins/setting-component.js.es6 +++ b/app/assets/javascripts/admin/mixins/setting-component.js.es6 @@ -113,6 +113,7 @@ export default Ember.Mixin.create({ .then(() => { this.set("validationMessage", null); this.commitBuffer(); + this.afterSave(); }) .catch(e => { if (e.jqXHR.responseJSON && e.jqXHR.responseJSON.errors) { diff --git a/app/assets/javascripts/admin/routes/admin-site-settings-category.js.es6 b/app/assets/javascripts/admin/routes/admin-site-settings-category.js.es6 index c90a099318f..a7744150830 100644 --- a/app/assets/javascripts/admin/routes/admin-site-settings-category.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-site-settings-category.js.es6 @@ -5,6 +5,10 @@ export default Discourse.Route.extend({ "categoryNameKey", params.category_id ); + this.controllerFor("adminSiteSettings").set( + "categoryNameKey", + params.category_id + ); return Ember.Object.create({ nameKey: params.category_id, name: I18n.t("admin.site_settings.categories." + params.category_id), diff --git a/app/assets/javascripts/admin/routes/admin-site-settings.js.es6 b/app/assets/javascripts/admin/routes/admin-site-settings.js.es6 index 58ac7246f53..b6c3e857ea9 100644 --- a/app/assets/javascripts/admin/routes/admin-site-settings.js.es6 +++ b/app/assets/javascripts/admin/routes/admin-site-settings.js.es6 @@ -15,5 +15,13 @@ export default Discourse.Route.extend({ if (!controller.get("visibleSiteSettings")) { controller.set("visibleSiteSettings", siteSettings); } + }, + + actions: { + refreshAll() { + SiteSetting.findAll().then(settings => { + this.controllerFor("adminSiteSettings").set("model", settings); + }); + } } }); diff --git a/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs index d13892157db..51711eee272 100644 --- a/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs +++ b/app/assets/javascripts/admin/templates/components/site-settings/upload.hbs @@ -1,2 +1,2 @@ -{{site-settings-image-uploader imageUrl=value type="site_setting"}} +{{site-settings-image-uploader imageUrl=value placeholderUrl=setting.placeholder type="site_setting"}}
{{i18n 'admin.site_settings.more_than_30_results'}}
diff --git a/app/assets/javascripts/discourse/components/image-uploader.js.es6 b/app/assets/javascripts/discourse/components/image-uploader.js.es6 index 5d468b15e6e..234de6e8434 100644 --- a/app/assets/javascripts/discourse/components/image-uploader.js.es6 +++ b/app/assets/javascripts/discourse/components/image-uploader.js.es6 @@ -21,13 +21,25 @@ export default Ember.Component.extend(UploadMixin, { } }, - @computed("imageUrl") - backgroundStyle(imageUrl) { - if (Ember.isEmpty(imageUrl)) { + @computed("imageUrl", "placeholderUrl") + showingPlaceholder(imageUrl, placeholderUrl) { + return !imageUrl && placeholderUrl; + }, + + @computed("placeholderUrl") + placeholderStyle(url) { + if (Ember.isEmpty(url)) { return "".htmlSafe(); } + return `background-image: url(${url})`.htmlSafe(); + }, - return `background-image: url(${imageUrl})`.htmlSafe(); + @computed("imageUrl") + backgroundStyle(url) { + if (Ember.isEmpty(url)) { + return "".htmlSafe(); + } + return `background-image: url(${url})`.htmlSafe(); }, @computed("imageUrl") @@ -36,11 +48,6 @@ export default Ember.Component.extend(UploadMixin, { return imageUrl.split("/").slice(-1)[0]; }, - @computed("backgroundStyle") - hasBackgroundStyle(backgroundStyle) { - return !Ember.isEmpty(backgroundStyle.string); - }, - validateUploadedFilesOptions() { return { imagesOnly: true }; }, diff --git a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs index c795a851a5a..716f4c646a6 100644 --- a/app/assets/javascripts/discourse/templates/components/image-uploader.hbs +++ b/app/assets/javascripts/discourse/templates/components/image-uploader.hbs @@ -1,11 +1,14 @@