From ad2926db4324306eb82168e68e771bdc1541e05a Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 13 Jul 2021 22:08:32 +0300 Subject: [PATCH 1/2] [SSE] Add "no icon" to format rule. Fix Bug 51270 --- .../app/template/FormatRulesEditDlg.template | 30 ++++---- .../main/app/view/FormatRulesEditDlg.js | 74 +++++++++++++------ apps/spreadsheeteditor/main/locale/en.json | 1 + 3 files changed, 67 insertions(+), 38 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template b/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template index 5b818504ba..4cdebbce44 100644 --- a/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template +++ b/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template @@ -162,45 +162,45 @@
diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index a5bc7b4b9c..595b61f68d 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -662,7 +662,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', type : i, template: _.template([ '' @@ -673,6 +675,7 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', style: 'min-width: 105px;', additionalAlign: this.menuAddAlign, items: [ + { caption: this.txtNoCellIcon, checkable: true, allowDepress: false, toggleGroup: 'no-cell-icons-' + (i+1) }, { template: _.template('
') } ] })).render($('#format-rules-combo-icon-' + (i+1))); @@ -684,10 +687,12 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', itemTemplate: _.template(''), type : i }); - picker.on('item:click', _.bind(this.onSelectIcon, this, combo)); + picker.on('item:click', _.bind(this.onSelectIcon, this, combo, menu.items[0])); + menu.items[0].on('toggle', _.bind(this.onSelectNoIcon, this, combo, picker)); this.iconsControls[i].cmbIcons = combo; this.iconsControls[i].pickerIcons = picker; + this.iconsControls[i].itemNoIcons = menu.items[0]; combo = new Common.UI.ComboBox({ el : $('#format-rules-edit-combo-op-' + (i+1)), @@ -1429,19 +1434,26 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', value.asc_setGte(controls.cmbOperator.getValue()); values.push(value); if (icons) { - var icon = controls.pickerIcons.getSelectedRec().get('value')+1; - for (var k=0; k0) { this.cmbIconsPresets.setValue(this.textCustom); _.each(icons, function(item) { - iconsIndexes.push(me.collectionPresets.at(item.asc_getIconSet()).get('icons')[item.asc_getIconId()]); + if (item.asc_getIconSet()==Asc.EIconSetType.NoIcons) { + iconsIndexes.push(-1); + } else + iconsIndexes.push(me.collectionPresets.at(item.asc_getIconSet()).get('icons')[item.asc_getIconId()]); }); } else { this.cmbIconsPresets.setValue(iconSet); @@ -1870,8 +1885,9 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', var len = iconsIndexes.length; for (var i=0; i div'); formcontrol.css('background-image', record ? 'url(' + record.get('imgUrl') + ')' : ''); + formcontrol.text(record ? '' : this.txtNoCellIcon); }, isRangeValid: function() { @@ -2191,7 +2218,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', textInvalid: 'Invalid data range.', textClear: 'Clear', textItem: 'Item', - textPresets: 'Presets' + textPresets: 'Presets', + txtNoCellIcon: 'No Icon' }, SSE.Views.FormatRulesEditDlg || {})); }); \ No newline at end of file diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 43ce5002ca..59f3f63726 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -2188,6 +2188,7 @@ "SSE.Views.FormatRulesEditDlg.txtTime": "Time", "SSE.Views.FormatRulesEditDlg.txtTitleEdit": "Edit Formatting Rule", "SSE.Views.FormatRulesEditDlg.txtTitleNew": "New Formatting Rule", + "SSE.Views.FormatRulesEditDlg.txtNoCellIcon": "No Icon", "SSE.Views.FormatRulesManagerDlg.guestText": "Guest", "SSE.Views.FormatRulesManagerDlg.text1Above": "1 std dev above average", "SSE.Views.FormatRulesManagerDlg.text1Below": "1 std dev below average", From ef6b13059b904aff182302e9f56dca2cfc3b6e60 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 13 Jul 2021 22:30:34 +0300 Subject: [PATCH 2/2] [SSE] Refactoring --- .../app/template/FormatRulesEditDlg.template | 20 +++++++++---------- .../main/app/view/FormatRulesEditDlg.js | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template b/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template index 4cdebbce44..f5a40a45a0 100644 --- a/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template +++ b/apps/spreadsheeteditor/main/app/template/FormatRulesEditDlg.template @@ -161,8 +161,8 @@ -
@@ -170,8 +170,8 @@ -
@@ -179,8 +179,8 @@ -
@@ -188,8 +188,8 @@ -
@@ -197,8 +197,8 @@ -
diff --git a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js index 595b61f68d..07fc6fbe3a 100644 --- a/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js +++ b/apps/spreadsheeteditor/main/app/view/FormatRulesEditDlg.js @@ -662,8 +662,8 @@ define([ 'text!spreadsheeteditor/main/app/template/FormatRulesEditDlg.template', type : i, template: _.template([ '