mirror of
https://github.com/discourse/discourse.git
synced 2025-05-24 03:36:18 +08:00
FEATURE: ability to add all active components to theme (#8447)
* FEATURE: ability to add all active components to theme * FIX: add a component to all themes takes only active ones * FIX: move select components/themes to top * FIX: improve defaultIsAvailable * FIX: Add filter(Boolean) and remove btn class
This commit is contained in:

committed by
GitHub

parent
46fc45de99
commit
bb69e8942e
@ -100,6 +100,28 @@ export default Mixin.create({
|
||||
return settingDefault !== bufferedValue;
|
||||
},
|
||||
|
||||
@discourseComputed("buffered.value")
|
||||
bufferedValues(bufferedValuesString) {
|
||||
return (
|
||||
bufferedValuesString && bufferedValuesString.split("|").filter(Boolean)
|
||||
);
|
||||
},
|
||||
|
||||
@discourseComputed("setting.defaultValues")
|
||||
defaultValues(defaultValuesString) {
|
||||
return (
|
||||
defaultValuesString && defaultValuesString.split("|").filter(Boolean)
|
||||
);
|
||||
},
|
||||
|
||||
@discourseComputed("defaultValues", "bufferedValues")
|
||||
defaultIsAvailable(defaultValues, bufferedValues) {
|
||||
return (
|
||||
defaultValues &&
|
||||
!defaultValues.every(value => bufferedValues.includes(value))
|
||||
);
|
||||
},
|
||||
|
||||
_watchEnterKey: on("didInsertElement", function() {
|
||||
$(this.element).on("keydown.setting-enter", ".input-setting-string", e => {
|
||||
if (e.keyCode === 13) {
|
||||
@ -216,7 +238,13 @@ export default Mixin.create({
|
||||
},
|
||||
|
||||
setDefaultValues() {
|
||||
this.set("buffered.value", this.get("setting.defaultValues"));
|
||||
this.set(
|
||||
"buffered.value",
|
||||
this.bufferedValues
|
||||
.concat(this.defaultValues)
|
||||
.uniq()
|
||||
.join("|")
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user