From d66ced9f9c3c3223647d50f5bb4c5b36da191692 Mon Sep 17 00:00:00 2001 From: Isaac Kearse Date: Wed, 26 Jan 2022 12:07:07 +1300 Subject: [PATCH] Fix text alignment in alert message When there is no error summary the alert message is wrapped in a p tag. This causes the message to be misaligned vertically. In the Bootstrap examples where there is single line of text, the text is not wrapped in a p tag: https://getbootstrap.com/docs/5.0/components/alerts/#examples --- lib/bootstrap_form/helpers/bootstrap.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/bootstrap_form/helpers/bootstrap.rb b/lib/bootstrap_form/helpers/bootstrap.rb index 8c11616ff..fd6a05ca1 100644 --- a/lib/bootstrap_form/helpers/bootstrap.rb +++ b/lib/bootstrap_form/helpers/bootstrap.rb @@ -27,8 +27,12 @@ def alert_message(title, options={}) return unless object.respond_to?(:errors) && object.errors.full_messages.any? tag.div class: css do - concat tag.p title - concat error_summary unless options[:error_summary] == false + if options[:error_summary] == false + title + else + concat tag.p title + concat error_summary + end end end