From 1a2ece03c890c5297867e235c2749336253fb25b Mon Sep 17 00:00:00 2001 From: Jeff Ohrstrom Date: Fri, 12 Jan 2024 13:24:00 -0500 Subject: [PATCH] small fixups for bc templates (#3289) Small fixups for batch connect templates - mostly UI related. --- .../javascript/prefill_templates/prefill_submit.js | 9 ++++----- .../prefill_templates/prefill_templates.js | 8 ++++---- .../batch_connect/session_contexts/_form.html.erb | 10 ++++------ .../session_contexts/_prefill_templates.html.erb | 12 ++++++------ apps/dashboard/config/locales/en.yml | 1 + 5 files changed, 19 insertions(+), 21 deletions(-) diff --git a/apps/dashboard/app/javascript/prefill_templates/prefill_submit.js b/apps/dashboard/app/javascript/prefill_templates/prefill_submit.js index e1a6d67376..11e261e947 100644 --- a/apps/dashboard/app/javascript/prefill_templates/prefill_submit.js +++ b/apps/dashboard/app/javascript/prefill_templates/prefill_submit.js @@ -4,14 +4,13 @@ const selectorID = "modal_input_template_name"; const newNameID = "modal_input_template_new_name"; export function prefillSubmitHandler() { - const form = $("#new_batch_connect_session_context"); const chooseTemplateName = $("#chooseTemplateName"); if (chooseTemplateName.length === 0) { return; } - const chooseTemplateNameError = $("#chooseTemplateNameError"); + const chooseTemplateNameError = $("#batch_connect_session_template_name_error_modal"); const templateName = $("#batch_connect_session_template_name"); const saveTemplate = $("#batch_connect_session_save_template"); @@ -24,7 +23,7 @@ export function prefillSubmitHandler() { } }); - $("#chooseTemplateNameConfirm").on("click", function () { + $("#batch_connect_session_template_choose_name_button").on("click", function () { const name = $(`#${selectorID}`).val() || $(`#${newNameID}`).val(); if (name === "") { chooseTemplateNameError.modal('show'); @@ -36,7 +35,7 @@ export function prefillSubmitHandler() { chooseTemplateName.modal('hide'); }); - saveTemplate.change(function () { + saveTemplate.on('change', function () { if ($(this).is(':checked')) { chooseTemplateName.modal('show'); } else { @@ -51,7 +50,7 @@ export function prefillSubmitHandler() { chooseTemplateName.on('hidden.bs.modal', function () { if (templateName.val() === "") { saveTemplate.prop('checked', false); - saveTemplate.change(); + saveTemplate.trigger('change'); } }); } diff --git a/apps/dashboard/app/javascript/prefill_templates/prefill_templates.js b/apps/dashboard/app/javascript/prefill_templates/prefill_templates.js index 4746a8a388..4a3de56134 100644 --- a/apps/dashboard/app/javascript/prefill_templates/prefill_templates.js +++ b/apps/dashboard/app/javascript/prefill_templates/prefill_templates.js @@ -15,8 +15,8 @@ export function prefillTemplatesHandler() { try { json = JSON.parse(templateOption.val()); } catch (error) { - $('#formPrefillErrorBody').text(error.message) - $('#formPrefillError').modal('show'); + $('#batch_connect_session_template_form_error_modal').text(error.message) + $('#batch_connect_session_template_form_error_modal_body').modal('show'); return; } @@ -57,8 +57,8 @@ export function prefillTemplatesHandler() { } if (errorMsg) { - $('#formPrefillErrorBody').html(errorMsg) - $('#formPrefillError').modal('show'); + $('#batch_connect_session_template_form_error_modal_body').html(errorMsg) + $('#batch_connect_session_template_form_error_modal').modal('show'); } }); } diff --git a/apps/dashboard/app/views/batch_connect/session_contexts/_form.html.erb b/apps/dashboard/app/views/batch_connect/session_contexts/_form.html.erb index 8145cd0b15..984c59faf0 100644 --- a/apps/dashboard/app/views/batch_connect/session_contexts/_form.html.erb +++ b/apps/dashboard/app/views/batch_connect/session_contexts/_form.html.erb @@ -6,12 +6,10 @@ <%= create_widget(f, attrib, format: @render_format) %> <% end %> -
-
- - - -
+
+ + +
<%= f.submit t('dashboard.batch_connect_form_launch'), class: "btn btn-primary btn-block" %> diff --git a/apps/dashboard/app/views/batch_connect/session_contexts/_prefill_templates.html.erb b/apps/dashboard/app/views/batch_connect/session_contexts/_prefill_templates.html.erb index 0bfe6079a1..98bcc47cfc 100644 --- a/apps/dashboard/app/views/batch_connect/session_contexts/_prefill_templates.html.erb +++ b/apps/dashboard/app/views/batch_connect/session_contexts/_prefill_templates.html.erb @@ -10,7 +10,7 @@
<%- end -%> - -