mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-29 13:52:10 +03:00
Fixed empty setting groups showing in nav bar
refs bc5be1a808
- after removing duplication for groups in the template we were showing empty groups because the group construction wasn't considering there may be no settings for a group
This commit is contained in:
parent
d12090cc14
commit
d3539655a0
@ -36,18 +36,24 @@ export default class DesignMenuComponent extends Component {
|
||||
|
||||
get settingGroups() {
|
||||
const groupKeys = this.KNOWN_GROUPS.map(g => g.key);
|
||||
const groups = [];
|
||||
|
||||
const groups = [{
|
||||
key: 'site-wide',
|
||||
name: 'Site-wide',
|
||||
icon: 'house',
|
||||
settings: this.themeSettings.filter(setting => !groupKeys.includes(setting.group))
|
||||
}];
|
||||
const siteWideSettings = this.themeSettings.filter(setting => !groupKeys.includes(setting.group));
|
||||
if (siteWideSettings.length) {
|
||||
groups.push({
|
||||
key: 'site-wide',
|
||||
name: 'Site-wide',
|
||||
icon: 'house',
|
||||
settings: siteWideSettings
|
||||
});
|
||||
}
|
||||
|
||||
this.KNOWN_GROUPS.forEach((knownGroup) => {
|
||||
groups.push(Object.assign({}, knownGroup, {
|
||||
settings: this.themeSettings.filter(setting => setting.group === knownGroup.key)
|
||||
}));
|
||||
const settings = this.themeSettings.filter(setting => setting.group === knownGroup.key);
|
||||
|
||||
if (settings.length) {
|
||||
groups.push(Object.assign({}, knownGroup, {settings}));
|
||||
}
|
||||
});
|
||||
|
||||
return groups;
|
||||
|
Loading…
Reference in New Issue
Block a user