[DE] Add menu to interface theme button and dark document button in view tab

This commit is contained in:
JuliaSvinareva 2021-12-08 23:54:07 +03:00
parent 4583e2014c
commit 4b29c97952
3 changed files with 35 additions and 1 deletions

View file

@ -111,6 +111,27 @@ define([
me.view.turnNavigation(state);
});
}
var menuItems = [],
currentTheme = Common.UI.Themes.currentThemeId() || Common.UI.Themes.defaultThemeId();
for (var t in Common.UI.Themes.map()) {
menuItems.push({
value: t,
caption: Common.UI.Themes.get(t).text,
checked: t === currentTheme,
checkable: true,
toggleGroup: 'interface-theme'
});
}
if ( menuItems.length ) {
this.view.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
this.view.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value;
Common.UI.Themes.setTheme(value);
this.view.btnDarkDocument.setDisabled(value !== 'theme-dark');
}, this));
}
},
}, DE.Controllers.ViewTab || {}));

View file

@ -198,6 +198,7 @@
<div class="separator long"></div>
<div class="group">
<span class="btn-slot text x-huge" id="slot-btn-interface-theme"></span>
<span class="btn-slot text x-huge" id="slot-btn-dark-document"></span>
</div>
<div class="separator long"></div>
<div class="group small">

View file

@ -137,6 +137,17 @@ define([
});
this.lockedControls.push(this.btnInterfaceTheme);
this.btnDarkDocument = new Common.UI.Button({
parentEl: $host.find('#slot-btn-dark-document'),
cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon night',
caption: this.textDarkDocument,
dataHint: '1',
dataHintDirection: 'bottom',
dataHintOffset: 'small'
});
this.lockedControls.push(this.btnDarkDocument);
this.chStatusbar = new Common.UI.CheckBox({
el: $host.findById('#slot-chk-statusbar'),
labelText: this.textStatusBar,
@ -205,7 +216,8 @@ define([
textInterfaceTheme: 'Interface theme',
textStatusBar: 'Status Bar',
textAlwaysShowToolbar: 'Always show toolbar',
textRulers: 'Rulers'
textRulers: 'Rulers',
textDarkDocument: 'Dark document'
}
}()), DE.Views.ViewTab || {}));
});