Browse Source

CLDC-4365: Allow for two thirds notifications

CLDC-4365-reduce-size-of-soft-validation-success-box
samyou-softwire 1 week ago
parent
commit
d53f12a586
  1. 14
      app/helpers/application_helper.rb
  2. 20
      app/views/layouts/application.html.erb

14
app/helpers/application_helper.rb

@ -32,6 +32,20 @@ module ApplicationHelper
!request.path.match?(/\/notifications\/\d+$/) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?) !request.path.match?(/\/notifications\/\d+$/) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?)
end end
def notification_banner
govuk_notification_banner(
title_text: "Success",
success: true, title_heading_level: 3,
title_id: "flash-notice",
role: "alert"
) do |notification_banner|
notification_banner.with_heading(text: flash.notice.html_safe)
if flash[:notification_banner_body]
tag.p flash[:notification_banner_body]&.html_safe
end
end
end
private private
def paginated_title(title, pagy) def paginated_title(title, pagy)

20
app/views/layouts/application.html.erb

@ -120,17 +120,15 @@
<main class="govuk-main-wrapper govuk-main-wrapper--auto-spacing" id="main-content" role="main"> <main class="govuk-main-wrapper govuk-main-wrapper--auto-spacing" id="main-content" role="main">
<% if flash.notice && !flash.notice.include?("translation missing") %> <% if flash.notice && !flash.notice.include?("translation missing") %>
<%= govuk_notification_banner( <% if flash[:notification_banner_two_thirds] %>
title_text: "Success", <div class="govuk-grid-row">
success: true, title_heading_level: 3, <div class="govuk-grid-column-two-thirds-from-desktop">
title_id: "flash-notice", <%= notification_banner %>
role: "alert" </div>
) do |notification_banner| </div>
notification_banner.with_heading(text: flash.notice.html_safe) <% else %>
if flash[:notification_banner_body] <%= notification_banner %>
tag.p flash[:notification_banner_body]&.html_safe <% end %>
end
end %>
<% end %> <% end %>
<%= content_for?(:content) ? yield(:content) : yield %> <%= content_for?(:content) ? yield(:content) : yield %>
</main> </main>

Loading…
Cancel
Save