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:
Krzysztof Kotlarek
2019-12-04 17:13:41 +11:00
committed by GitHub
parent 46fc45de99
commit bb69e8942e
7 changed files with 118 additions and 81 deletions
@@ -23,7 +23,13 @@ export default Controller.extend({
editRouteName: "adminCustomizeThemes.edit",
parentThemesNames: mapBy("model.parentThemes", "name"),
availableParentThemes: filterBy("allThemes", "component", false),
availableActiveParentThemes: filterBy("availableParentThemes", "isActive"),
availableThemesNames: mapBy("availableParentThemes", "name"),
availableActiveThemesNames: mapBy("availableActiveParentThemes", "name"),
availableActiveChildThemes: filterBy("availableChildThemes", "hasParents"),
availableComponentsNames: mapBy("availableChildThemes", "name"),
availableActiveComponentsNames: mapBy("availableActiveChildThemes", "name"),
childThemesNames: mapBy("model.childThemes", "name"),
@discourseComputed("model.editedFields")
editedFieldsFormatted() {
@@ -60,7 +66,7 @@ export default Controller.extend({
},
@discourseComputed("model.parentThemes.[]")
relativesSelectorSettings() {
relativesSelectorSettingsForComponent() {
return Ember.Object.create({
list_type: "compact",
type: "list",
@@ -71,12 +77,30 @@ export default Controller.extend({
choices: this.availableThemesNames,
default: this.parentThemesNames.join("|"),
value: this.parentThemesNames.join("|"),
defaultValues: this.availableThemesNames.join("|"),
defaultValues: this.availableActiveThemesNames.join("|"),
allThemes: this.allThemes,
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all_themes")
});
},
@discourseComputed("model.parentThemes.[]")
relativesSelectorSettingsForTheme() {
return Ember.Object.create({
list_type: "compact",
type: "list",
preview: null,
anyValue: false,
setting: "child_theme_ids",
label: I18n.t("admin.customize.theme.included_components"),
choices: this.availableComponentsNames,
default: this.childThemesNames.join("|"),
value: this.childThemesNames.join("|"),
defaultValues: this.availableActiveComponentsNames.join("|"),
allThemes: this.allThemes,
setDefaultValuesLabel: I18n.t("admin.customize.theme.add_all")
});
},
@discourseComputed("allThemes", "model.component", "model")
availableChildThemes(allThemes) {
if (!this.get("model.component")) {