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