mirror of
https://github.com/discourse/discourse.git
synced 2025-05-28 12:02:05 +08:00
FEATURE: Ability to add components to all themes (#8404)
* FEATURE: Ability to add components to all themes This is the first and functional step from that topic https://dev.discourse.org/t/adding-a-theme-component-is-too-much-work/15398/16 The idea here is that when a new component is added, the user can easily assign it to all themes (parents). To achieve that, I needed to change a site-setting component to accept `setDefaultValues` action and `setDefaultValuesLabel` translated label. Also, I needed to add `allowAny` option to disable that for theme selector. I also refactored backend to accept both parent and child ids with one method to avoid duplication (Renamed `add_child_theme!` to more general `add_relative_theme!`) * FIX: Improvement after code review * FIX: Improvement after code review2 * FIX: use mapBy and filterBy directly
This commit is contained in:

committed by
GitHub

parent
7371b427cd
commit
b120728999
@ -51,7 +51,6 @@ export default Mixin.create({
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
let preview = setting.get("preview");
|
||||
if (preview) {
|
||||
return new Handlebars.SafeString(
|
||||
@ -67,9 +66,9 @@ export default Mixin.create({
|
||||
return componentType.replace(/\_/g, "-");
|
||||
},
|
||||
|
||||
@discourseComputed("setting.setting")
|
||||
settingName(setting) {
|
||||
return setting.replace(/\_/g, " ");
|
||||
@discourseComputed("setting.setting", "setting.label")
|
||||
settingName(setting, label) {
|
||||
return label || setting.replace(/\_/g, " ");
|
||||
},
|
||||
|
||||
@discourseComputed("type")
|
||||
@ -91,6 +90,11 @@ export default Mixin.create({
|
||||
return "site-settings/" + typeClass;
|
||||
},
|
||||
|
||||
@discourseComputed("setting.anyValue")
|
||||
allowAny(anyValue) {
|
||||
return anyValue !== false;
|
||||
},
|
||||
|
||||
@discourseComputed("setting.default", "buffered.value")
|
||||
overridden(settingDefault, bufferedValue) {
|
||||
return settingDefault !== bufferedValue;
|
||||
@ -209,6 +213,10 @@ export default Mixin.create({
|
||||
|
||||
toggleSecret() {
|
||||
this.toggleProperty("isSecret");
|
||||
},
|
||||
|
||||
setDefaultValues() {
|
||||
this.set("buffered.value", this.get("setting.defaultValues"));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user