[DE] 'left' menu refactoring

This commit is contained in:
Maxim Kadushkin 2019-07-29 16:56:47 +03:00
parent 4725e80119
commit 56201f99c5

View file

@ -90,13 +90,11 @@ define([
}, },
render: function () { render: function () {
var el = $(this.el); var $markup = $(this.template({}));
el.html(this.template({
}));
this.btnSearch = new Common.UI.Button({ this.btnSearch = new Common.UI.Button({
action: 'search', action: 'search',
el: $('#left-btn-search'), el: $markup.elementById('#left-btn-search'),
hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'), hint: this.tipSearch + Common.Utils.String.platformKey('Ctrl+F'),
disabled: true, disabled: true,
enableToggle: true enableToggle: true
@ -104,7 +102,7 @@ define([
this.btnAbout = new Common.UI.Button({ this.btnAbout = new Common.UI.Button({
action: 'about', action: 'about',
el: $('#left-btn-about'), el: $markup.elementById('#left-btn-about'),
hint: this.tipAbout, hint: this.tipAbout,
enableToggle: true, enableToggle: true,
disabled: true, disabled: true,
@ -113,14 +111,14 @@ define([
this.btnSupport = new Common.UI.Button({ this.btnSupport = new Common.UI.Button({
action: 'support', action: 'support',
el: $('#left-btn-support'), el: $markup.elementById('#left-btn-support'),
hint: this.tipSupport, hint: this.tipSupport,
disabled: true disabled: true
}); });
/** coauthoring begin **/ /** coauthoring begin **/
this.btnComments = new Common.UI.Button({ this.btnComments = new Common.UI.Button({
el: $('#left-btn-comments'), el: $markup.elementById('#left-btn-comments'),
hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'), hint: this.tipComments + Common.Utils.String.platformKey('Ctrl+Shift+H'),
enableToggle: true, enableToggle: true,
disabled: true, disabled: true,
@ -128,7 +126,7 @@ define([
}); });
this.btnChat = new Common.UI.Button({ this.btnChat = new Common.UI.Button({
el: $('#left-btn-chat'), el: $markup.elementById('#left-btn-chat'),
hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'), hint: this.tipChat + Common.Utils.String.platformKey('Alt+Q'),
enableToggle: true, enableToggle: true,
disabled: true, disabled: true,
@ -138,32 +136,34 @@ define([
this.btnComments.hide(); this.btnComments.hide();
this.btnChat.hide(); this.btnChat.hide();
this.btnComments.on('click', _.bind(this.onBtnMenuClick, this)); this.btnComments.on('click', this.onBtnMenuClick.bind(this));
this.btnComments.on('toggle', _.bind(this.onBtnCommentsToggle, this)); this.btnComments.on('toggle', this.onBtnCommentsToggle.bind(this));
this.btnChat.on('click', _.bind(this.onBtnMenuClick, this)); this.btnChat.on('click', this.onBtnMenuClick.bind(this));
/** coauthoring end **/ /** coauthoring end **/
this.btnPlugins = new Common.UI.Button({ this.btnPlugins = new Common.UI.Button({
el: $('#left-btn-plugins'), el: $markup.elementById('#left-btn-plugins'),
hint: this.tipPlugins, hint: this.tipPlugins,
enableToggle: true, enableToggle: true,
disabled: true, disabled: true,
toggleGroup: 'leftMenuGroup' toggleGroup: 'leftMenuGroup'
}); });
this.btnPlugins.hide(); this.btnPlugins.hide();
this.btnPlugins.on('click', _.bind(this.onBtnMenuClick, this)); this.btnPlugins.on('click', this.onBtnMenuClick.bind(this));
this.btnNavigation = new Common.UI.Button({ this.btnNavigation = new Common.UI.Button({
el: $('#left-btn-navigation'), el: $markup.elementById('#left-btn-navigation'),
hint: this.tipNavigation, hint: this.tipNavigation,
enableToggle: true, enableToggle: true,
disabled: true, disabled: true,
toggleGroup: 'leftMenuGroup' toggleGroup: 'leftMenuGroup'
}); });
this.btnNavigation.on('click', _.bind(this.onBtnMenuClick, this)); this.btnNavigation.on('click', this.onBtnMenuClick.bind(this));
this.btnSearch.on('click', _.bind(this.onBtnMenuClick, this)); this.btnSearch.on('click', this.onBtnMenuClick.bind(this));
this.btnAbout.on('toggle', _.bind(this.onBtnMenuToggle, this)); this.btnAbout.on('toggle', this.onBtnMenuToggle.bind(this));
this.$el.html($markup);
this.menuFile = new DE.Views.FileMenu(); this.menuFile = new DE.Views.FileMenu();
this.menuFile.render(); this.menuFile.render();