From 9af27477c2705695a9052d0285457370546301aa Mon Sep 17 00:00:00 2001 From: Shreyes Lata Date: Sun, 13 Dec 2020 22:33:19 +0530 Subject: [PATCH 1/2] feat: trigger Create Project button on Enter key press in Project Name field --- .../index/default-importing-controller/parsing-panel.html | 4 ++-- .../index/default-importing-controller/parsing-panel.js | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html index f8930ef26a16..1b0343411b22 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html @@ -7,7 +7,7 @@ - + @@ -15,7 +15,7 @@ - + diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js index 5377a10321c6..3976911d7ad4 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js @@ -99,6 +99,12 @@ Refine.DefaultImportingController.prototype._prepareParsingPanel = function() { this._parsingPanelElmts.previousButton.html($.i18n('core-buttons/previous')); this._parsingPanelElmts.startOverButton.html($.i18n('core-buttons/startover')); this._parsingPanelElmts.nextButton.html($.i18n('core-buttons/create-project')); + document.getElementById("projectNameTextField") + .addEventListener("keyup", function(e) { + if (e.code === 'Enter') { + document.getElementById("createButton").click(); + } + }); $('#or-import-parsopt').text($.i18n('core-index-import/parsing-options')); $('#or-import-projname').html($.i18n('core-index-import/project-name')); $('#or-import-projtags').html($.i18n('core-index-import/project-tags')); From 150fa5188fbd1e5a5f424903f5c97d4953af326d Mon Sep 17 00:00:00 2001 From: Shreyes Lata Date: Sun, 27 Dec 2020 00:15:47 +0530 Subject: [PATCH 2/2] Call createButton action on 'Enter' key press event on project name input field --- .../default-importing-controller/parsing-panel.html | 2 +- .../default-importing-controller/parsing-panel.js | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html index 1b0343411b22..0b052e89c12f 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.html @@ -15,7 +15,7 @@ - + diff --git a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js index 3976911d7ad4..2daa97b76de5 100644 --- a/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js +++ b/main/webapp/modules/core/scripts/index/default-importing-controller/parsing-panel.js @@ -99,12 +99,13 @@ Refine.DefaultImportingController.prototype._prepareParsingPanel = function() { this._parsingPanelElmts.previousButton.html($.i18n('core-buttons/previous')); this._parsingPanelElmts.startOverButton.html($.i18n('core-buttons/startover')); this._parsingPanelElmts.nextButton.html($.i18n('core-buttons/create-project')); - document.getElementById("projectNameTextField") - .addEventListener("keyup", function(e) { - if (e.code === 'Enter') { - document.getElementById("createButton").click(); - } - }); + + // Submit the form directly by hitting Enter key + document.getElementById("projectNameTextField").addEventListener("keyup", function (event) { + if (event.code === 'Enter') + self._createProject(); + }); + $('#or-import-parsopt').text($.i18n('core-index-import/parsing-options')); $('#or-import-projname').html($.i18n('core-index-import/project-name')); $('#or-import-projtags').html($.i18n('core-index-import/project-tags'));