Browse Source

Merge ac5063bced into 614fd111e5

pull/3338/merge
Samuel Young 5 days ago committed by GitHub
parent
commit
abeef8aee8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      app/controllers/form_controller.rb
  2. 15
      app/helpers/application_helper.rb
  3. 16
      app/views/layouts/application.html.erb

1
app/controllers/form_controller.rb

@ -25,6 +25,7 @@ class FormController < ApplicationController
updated_question = @page.questions.reject { |question| question.check_answer_label.blank? }.first
updated_question_string = [updated_question&.question_number_string, updated_question&.check_answer_label.to_s.downcase].compact.join(": ")
flash[:notice] = "You have successfully updated #{updated_question_string}"
flash[:notification_banner_two_thirds] = true
end
update_duplication_tracking

15
app/helpers/application_helper.rb

@ -32,6 +32,21 @@ module ApplicationHelper
!request.path.match?(/\/notifications\/\d+$/) && (authenticated_user_has_notifications? || unauthenticated_user_has_notifications?)
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
def paginated_title(title, pagy)

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

@ -120,17 +120,11 @@
<main class="govuk-main-wrapper govuk-main-wrapper--auto-spacing" id="main-content" role="main">
<% if flash.notice && !flash.notice.include?("translation missing") %>
<%= 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 %>
<div class="govuk-grid-row">
<div class="<%= flash[:notification_banner_two_thirds] ? "govuk-grid-column-two-thirds-from-desktop" : "govuk-grid-column-full" %>">
<%= notification_banner %>
</div>
</div>
<% end %>
<%= content_for?(:content) ? yield(:content) : yield %>
</main>

Loading…
Cancel
Save