From d21ca26b2fee9ff25ce46ee37f64ef0a1ddc86b1 Mon Sep 17 00:00:00 2001 From: Daniel Sader Date: Mon, 1 Apr 2019 14:53:50 -0300 Subject: [PATCH] Added Select All/Select None buttons to Excel importer --- .../parser-interfaces/excel-parser-ui.html | 2 ++ .../parser-interfaces/excel-parser-ui.js | 28 +++++++++++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.html b/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.html index 43c35a01e..c15f56122 100644 --- a/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.html +++ b/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.html @@ -11,6 +11,8 @@
+ +
diff --git a/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.js b/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.js index 37b89e976..533351dd6 100644 --- a/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.js +++ b/main/webapp/modules/core/scripts/index/parser-interfaces/excel-parser-ui.js @@ -118,9 +118,12 @@ Refine.ExcelParserUI.prototype._initialize = function() { this._optionContainer.unbind().empty().html( DOM.loadHTML("core", "scripts/index/parser-interfaces/excel-parser-ui.html")); this._optionContainerElmts = DOM.bind(this._optionContainer); - this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); - + this._optionContainerElmts.previewButton.click(function() { self._updatePreview(); }); this._optionContainerElmts.previewButton.html($.i18n('core-buttons/update-preview')); + this._optionContainerElmts.selectAllButton.click(function() { self._selectAll(); }); + this._optionContainerElmts.selectAllButton.html($.i18n('core-buttons/select-all')); + this._optionContainerElmts.unselectAllButton.click(function() { self._unselectAll(); }); + this._optionContainerElmts.unselectAllButton.html($.i18n('core-buttons/unselect-all')); $('#or-import-worksheet').text($.i18n('core-index-import/import-worksheet')); $('#or-import-ignore').text($.i18n('core-index-parser/ignore-first')); $('#or-import-lines').text($.i18n('core-index-parser/lines-beg')); @@ -142,6 +145,7 @@ Refine.ExcelParserUI.prototype._initialize = function() { var checkbox = $('') .attr('id', id) .attr('type', 'checkbox') + .attr('class', 'core-excel-worksheet') .attr('index', i) .appendTo(td0); if (this.selected) { @@ -222,3 +226,23 @@ Refine.ExcelParserUI.prototype._updatePreview = function() { self._progressContainer.hide(); }); }; + +Refine.ExcelParserUI.prototype._selectAll = function() { + var self = this; + + $(".core-excel-worksheet").each(function(index, value){ + $(value).prop('checked', true); + }); + + self._scheduleUpdatePreview(); +} + +Refine.ExcelParserUI.prototype._unselectAll = function() { + var self = this; + + $(".core-excel-worksheet").each(function(index, value){ + $(value).prop('checked', false); + }); + + self._scheduleUpdatePreview(); +} \ No newline at end of file