[PE SSE] Add handlers to interface theme buttons in view tab

This commit is contained in:
JuliaSvinareva 2021-12-12 20:44:54 +03:00
parent 980cfb73f9
commit 6633548659
3 changed files with 42 additions and 4 deletions

View file

@ -141,6 +141,26 @@ define([
})).then(function () { })).then(function () {
me.view.setEvents(); me.view.setEvents();
}); });
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 file

@ -137,9 +137,8 @@ define([
this.btnInterfaceTheme = new Common.UI.Button({ this.btnInterfaceTheme = new Common.UI.Button({
parentEl: $host.find('#slot-btn-interface-theme'), parentEl: $host.find('#slot-btn-interface-theme'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon', iconCls: 'toolbar__icon day',
caption: this.textInterfaceTheme, caption: this.textInterfaceTheme,
split: true,
menu: true, menu: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',

View file

@ -218,9 +218,8 @@ define([
this.btnInterfaceTheme = new Common.UI.Button({ this.btnInterfaceTheme = new Common.UI.Button({
parentEl: $host.find('#slot-btn-interface-theme'), parentEl: $host.find('#slot-btn-interface-theme'),
cls: 'btn-toolbar x-huge icon-top', cls: 'btn-toolbar x-huge icon-top',
iconCls: 'toolbar__icon', iconCls: 'toolbar__icon day',
caption: this.textInterfaceTheme, caption: this.textInterfaceTheme,
split: true,
menu: true, menu: true,
dataHint: '1', dataHint: '1',
dataHintDirection: 'bottom', dataHintDirection: 'bottom',
@ -292,6 +291,26 @@ define([
})); }));
me.btnFreezePanes.updateHint(me.tipFreeze); me.btnFreezePanes.updateHint(me.tipFreeze);
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) {
me.btnInterfaceTheme.setMenu(new Common.UI.Menu({items: menuItems}));
me.btnInterfaceTheme.menu.on('item:click', _.bind(function (menu, item) {
var value = item.value;
Common.UI.Themes.setTheme(value);
}, me));
}
setEvents.call(me); setEvents.call(me);
}); });
}, },