Layerable themes
This commit is contained in:
@@ -158,14 +158,17 @@ class ComponentManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getActiveTheme() {
|
getActiveThemes() {
|
||||||
return this.componentsForArea("themes").find((theme) => {return theme.active});
|
return this.componentsForArea("themes").filter((theme) => {return theme.active});
|
||||||
}
|
}
|
||||||
|
|
||||||
postActiveThemeToComponent(component) {
|
postActiveThemeToComponent(component) {
|
||||||
var activeTheme = this.getActiveTheme();
|
var themes = this.getActiveThemes();
|
||||||
|
var urls = themes.map((theme) => {
|
||||||
|
return this.urlForComponent(theme);
|
||||||
|
})
|
||||||
var data = {
|
var data = {
|
||||||
themes: [activeTheme ? this.urlForComponent(activeTheme) : null]
|
themes: urls
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sendMessageToComponent(component, {action: "themes", data: data})
|
this.sendMessageToComponent(component, {action: "themes", data: data})
|
||||||
@@ -586,11 +589,13 @@ class ComponentManager {
|
|||||||
if(targetComponent.active) {
|
if(targetComponent.active) {
|
||||||
this.deactivateComponent(targetComponent);
|
this.deactivateComponent(targetComponent);
|
||||||
} else {
|
} else {
|
||||||
if(targetComponent.content_type == "SN|Theme") {
|
if(targetComponent.content_type == "SN|Theme" && !targetComponent.package_info.layerable) {
|
||||||
// Deactive currently active theme
|
// Deactive currently active theme if new theme is not layerable
|
||||||
var activeTheme = this.getActiveTheme();
|
var activeThemes = this.getActiveThemes();
|
||||||
if(activeTheme) {
|
for(var theme of activeThemes) {
|
||||||
this.deactivateComponent(activeTheme);
|
if(theme && !theme.package_info.layerable) {
|
||||||
|
this.deactivateComponent(theme);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.activateComponent(targetComponent);
|
this.activateComponent(targetComponent);
|
||||||
|
|||||||
Reference in New Issue
Block a user