diff --git a/app/assets/javascripts/assets/wopi/create_wopi_file.js b/app/assets/javascripts/assets/wopi/create_wopi_file.js index c796897e3..f99eac947 100644 --- a/app/assets/javascripts/assets/wopi/create_wopi_file.js +++ b/app/assets/javascripts/assets/wopi/create_wopi_file.js @@ -9,6 +9,7 @@ function applyCreateWopiFileCallback() { $modal.find('#element_id').val($(this).data('id')); $modal.find('#element_type').val($(this).data('type')); $modal.modal('show'); + $($modal).find('#new-wopi-file-name').focus(); return false; }); diff --git a/app/assets/javascripts/experiments/table.js b/app/assets/javascripts/experiments/table.js index 3b61b8a01..ebe872033 100644 --- a/app/assets/javascripts/experiments/table.js +++ b/app/assets/javascripts/experiments/table.js @@ -333,6 +333,13 @@ var ExperimnetTable = { } }); }, + initModalInputFocus: function() { + $(document).on('shown.bs.modal', function() { + var inputField = $('#edit-module-name-input'); + var value = inputField.val(); + inputField.focus().val('').val(value); + }); + }, initMoveModulesModal: function() { $('#moveTask').on('click', () => { this.openMoveModulesModal(this.selectedMyModules); @@ -639,6 +646,7 @@ var ExperimnetTable = { this.initMyModuleActions(); this.initRestoreMyModules(); this.initManageUsersDropdown(); + this.initModalInputFocus(); } }; diff --git a/app/assets/javascripts/projects/canvas.js.erb b/app/assets/javascripts/projects/canvas.js.erb index e60c27000..3e1b26eba 100644 --- a/app/assets/javascripts/projects/canvas.js.erb +++ b/app/assets/javascripts/projects/canvas.js.erb @@ -1522,7 +1522,9 @@ function initEditModules() { }) .on("shown.bs.modal", function(event) { // Focus the text element - $(this).find("#edit-module-name-input").focus(); + var inputField = $('#edit-module-name-input'); + var value = inputField.val(); + inputField.focus().val('').val(value); }) .on("hide.bs.modal", function (event) { // Remove potential error classes @@ -2960,7 +2962,7 @@ function drawRoundRectangle(ctx, xPos, yPos, width, height, radius) { height = Math.max(height, 0) if (width < 2 * radius) radius = width / 2; if (height < 2 * radius) radius = height / 2; - + ctx.beginPath(); ctx.lineWidth = 4; ctx.strokeStyle = '#104DA9'; diff --git a/app/assets/javascripts/projects/index.js b/app/assets/javascripts/projects/index.js index 98733a8fb..861cd95d3 100644 --- a/app/assets/javascripts/projects/index.js +++ b/app/assets/javascripts/projects/index.js @@ -42,7 +42,6 @@ var ProjectsIndex = (function() { // Init new project folder modal function function initNewProjectFolderModal() { var newProjectFolderModal = '#new-project-folder-modal'; - // Modal's submit handler function $(projectsWrapper) .on('ajax:success', newProjectFolderModal, function(ev, data) { @@ -328,6 +327,13 @@ var ProjectsIndex = (function() { $.get(url, function(result) { $(editProjectModal).find('.modal-content').html(result.html); $(editProjectModal).modal('show'); + // focusing at the end of the field + ['project_name', 'project_folder_name'].forEach(function(inputId) { + var inputField = $('#' + inputId); + var value = inputField.val(); + inputField.focus().val('').val(value); + }); + $(editProjectModal).find('.selectpicker').selectpicker(); $(editProjectModal).find('form') .on('ajax:success', function(ev, data) { @@ -412,7 +418,7 @@ var ProjectsIndex = (function() { $(moveToModal).find('.modal-content').html(result.html); $(moveToModal).modal('show'); initializeJSTree($(moveToModal).find('#moveToFolders')); - + $('#searchFolderTree').focus(); $(moveToModal).find('form') .on('ajax:before', function() { $('').attr({ diff --git a/app/assets/javascripts/projects/show.js b/app/assets/javascripts/projects/show.js index ea8292bf6..e9d387b44 100644 --- a/app/assets/javascripts/projects/show.js +++ b/app/assets/javascripts/projects/show.js @@ -323,6 +323,12 @@ }); } + $(document).on('shown.bs.modal', function() { + var inputField = $('#experiment-name'); + var value = inputField.val(); + inputField.focus().val('').val(value); + }); + function initNewExperimentToolbarButton() { let forms = '.new-experiment-form'; $(experimentsPage) diff --git a/app/assets/javascripts/sitewide/drag_n_drop.js b/app/assets/javascripts/sitewide/drag_n_drop.js index 5db7df525..cf786b602 100644 --- a/app/assets/javascripts/sitewide/drag_n_drop.js +++ b/app/assets/javascripts/sitewide/drag_n_drop.js @@ -328,7 +328,7 @@
-
diff --git a/app/javascript/vue/protocol/step_attachments/mixins/wopi_file_modal.js b/app/javascript/vue/protocol/step_attachments/mixins/wopi_file_modal.js index 4d8505ff5..d6686fc1b 100644 --- a/app/javascript/vue/protocol/step_attachments/mixins/wopi_file_modal.js +++ b/app/javascript/vue/protocol/step_attachments/mixins/wopi_file_modal.js @@ -8,6 +8,7 @@ export default { $wopiModal.find('#element_id').val(step.id); $wopiModal.find('#element_type').val('Step'); $wopiModal.modal('show'); + $($wopiModal).find('#new-wopi-file-name').focus(); $wopiModal.find('form').on( 'ajax:success',