From 42eae72d2a91540489076484ccf47dd9f11ade37 Mon Sep 17 00:00:00 2001 From: sboursen-scinote Date: Mon, 30 Jan 2023 12:00:33 +0100 Subject: [PATCH] Update the layout of the move-experiment-modal when there are errors [SCI-7676] --- app/assets/javascripts/sitewide/form_errors.js | 3 ++- app/assets/stylesheets/shared/form_errors.scss | 7 +++++++ app/controllers/experiments_controller.rb | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/sitewide/form_errors.js b/app/assets/javascripts/sitewide/form_errors.js index 8a11b5723..789ce42bc 100644 --- a/app/assets/javascripts/sitewide/form_errors.js +++ b/app/assets/javascripts/sitewide/form_errors.js @@ -42,8 +42,9 @@ var renderFormError = function(ev, input, errMsgs, clearErr, errAttributes) { } var $errSpan = "' + errorText + ''; + errAttributes + '>' + errorText + '.' + ''; $(input).after($errSpan); + $(input).closest('.modal').modal('handleUpdate'); } var $parent; diff --git a/app/assets/stylesheets/shared/form_errors.scss b/app/assets/stylesheets/shared/form_errors.scss index d0ec643f0..52a441c8a 100644 --- a/app/assets/stylesheets/shared/form_errors.scss +++ b/app/assets/stylesheets/shared/form_errors.scss @@ -4,3 +4,10 @@ color: $brand-danger; } } + +.form-group.has-error { + margin-bottom: 0; + div.form-control { + height: auto; + } +} diff --git a/app/controllers/experiments_controller.rb b/app/controllers/experiments_controller.rb index 13eb02177..795df0279 100644 --- a/app/controllers/experiments_controller.rb +++ b/app/controllers/experiments_controller.rb @@ -310,7 +310,7 @@ class ExperimentsController < ApplicationController view_type = view_state.state['my_modules']['view_type'] || 'canvas' path = view_mode_redirect_url(view_type) else - message = service.errors.values.join(', ') + message = "#{service.errors.values.join('. ')}." status = :unprocessable_entity end