From 20ef76ed6d402f9218c5ac1daf474d7edf6cf22d Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Thu, 21 Apr 2016 13:15:15 +0300 Subject: [PATCH] [SSE] Bug 32279, 32277, 32278 --- apps/common/main/resources/less/buttons.less | 4 ++-- .../main/app/controller/RightMenu.js | 24 +++++++++++++++++-- .../main/app/view/CellRangeDialog.js | 7 ++++++ .../main/app/view/RightMenu.js | 16 ------------- .../main/app/view/TableOptionsDialog.js | 15 +++++------- .../main/app/view/TableSettings.js | 1 + 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/apps/common/main/resources/less/buttons.less b/apps/common/main/resources/less/buttons.less index f6b3efd21..89da9000e 100644 --- a/apps/common/main/resources/less/buttons.less +++ b/apps/common/main/resources/less/buttons.less @@ -146,8 +146,8 @@ background-color: @secondary; } - &:active, - &.active { + &:active:not(.disabled), + &.active:not(.disabled) { background-color: @primary; color: #fff; } diff --git a/apps/spreadsheeteditor/main/app/controller/RightMenu.js b/apps/spreadsheeteditor/main/app/controller/RightMenu.js index 7dcdad34f..b6a014a10 100644 --- a/apps/spreadsheeteditor/main/app/controller/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/controller/RightMenu.js @@ -219,8 +219,7 @@ define([ }, onCoAuthoringDisconnect: function() { - if (this.rightmenu) - this.rightmenu.SetDisabled('', true, true); + this.SetDisabled(true); this.setMode({isEdit: false}); }, @@ -298,6 +297,27 @@ define([ case Asc.c_oAscTypeSelectElement.Image: return Common.Utils.documentSettingsType.Image; } + }, + + SetDisabled: function(disabled) { + if (this.rightmenu) { + this.rightmenu.paragraphSettings.disableControls(disabled); + this.rightmenu.shapeSettings.disableControls(disabled); + this.rightmenu.imageSettings.disableControls(disabled); + this.rightmenu.chartSettings.disableControls(disabled); + this.rightmenu.tableSettings.disableControls(disabled); + + if (disabled) { + this.rightmenu.btnText.setDisabled(disabled); + this.rightmenu.btnTable.setDisabled(disabled); + this.rightmenu.btnImage.setDisabled(disabled); + this.rightmenu.btnShape.setDisabled(disabled); + this.rightmenu.btnTextArt.setDisabled(disabled); + this.rightmenu.btnChart.setDisabled(disabled); + } else { + this.onSelectionChanged(this.api.asc_getCellInfo()); + } + } } }); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js index 974833e78..232df0660 100644 --- a/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js +++ b/apps/spreadsheeteditor/main/app/view/CellRangeDialog.js @@ -142,6 +142,8 @@ define([ if (this.api) this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.None); + + SSE.getController('RightMenu').SetDisabled(false); }, onKeyPress: function(event) { @@ -162,6 +164,11 @@ define([ this.close(); }, + show: function () { + Common.UI.Window.prototype.show.call(this); + SSE.getController('RightMenu').SetDisabled(true); + }, + txtTitle : 'Select Data Range', textCancel : 'Cancel', txtEmpty : 'This field is required', diff --git a/apps/spreadsheeteditor/main/app/view/RightMenu.js b/apps/spreadsheeteditor/main/app/view/RightMenu.js index 6656b3936..1bd466574 100644 --- a/apps/spreadsheeteditor/main/app/view/RightMenu.js +++ b/apps/spreadsheeteditor/main/app/view/RightMenu.js @@ -237,22 +237,6 @@ define([ return (this.minimizedMode) ? null : $(".settings-panel.active")[0].id; }, - SetDisabled: function(id, disabled, all) { - if (all) { - this.paragraphSettings.disableControls(disabled); - this.shapeSettings.disableControls(disabled); - this.imageSettings.disableControls(disabled); - this.chartSettings.disableControls(disabled); - this.tableSettings.disableControls(disabled); - } else { - var cmp = $("#" + id); - if (disabled !== cmp.hasClass('disabled')) { - cmp.toggleClass('disabled', disabled); - (disabled) ? cmp.attr({disabled: disabled}) : cmp.removeAttr('disabled'); - } - } - }, - clearSelection: function() { var target_pane = $(".right-panel"); target_pane.find('> .active').removeClass('active'); diff --git a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js index 6cfa26140..621f77f49 100644 --- a/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/TableOptionsDialog.js @@ -179,9 +179,10 @@ define([ onClose: function(event) { if (this.api) this.api.asc_setSelectionDialogMode(Asc.c_oAscSelectionDialogType.None); - Common.NotificationCenter.trigger('cells:range', Asc.c_oAscSelectionDialogType.None); Common.NotificationCenter.trigger('edit:complete', this); + + SSE.getController('RightMenu').SetDisabled(false); }, onKeyPress: function(event) { @@ -202,14 +203,10 @@ define([ this.close(); }, -// show: function () { -// Common.UI.Window.prototype.show.call(this); -// -// var me = this; -// _.delay(function () { -// me.inputRange.cmpEl.find('input').focus(); -// }, 500, me); -// }, + show: function () { + Common.UI.Window.prototype.show.call(this); + SSE.getController('RightMenu').SetDisabled(true); + }, txtTitle : 'Title', txtFormat : 'Create table', diff --git a/apps/spreadsheeteditor/main/app/view/TableSettings.js b/apps/spreadsheeteditor/main/app/view/TableSettings.js index e898e7d99..4f326c922 100644 --- a/apps/spreadsheeteditor/main/app/view/TableSettings.js +++ b/apps/spreadsheeteditor/main/app/view/TableSettings.js @@ -137,6 +137,7 @@ define([ el: $('#table-btn-select-data') }); this.btnSelectData.on('click', _.bind(this.onSelectData, this)); + this.lockedControls.push(this.btnSelectData); this.btnEdit = new Common.UI.Button({ cls: 'btn-icon-default',