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 = @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(": ") 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[:notice] = "You have successfully updated #{updated_question_string}"
flash[:notification_banner_two_thirds] = true
end end
update_duplication_tracking 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?) !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)

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"> <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( <div class="govuk-grid-row">
title_text: "Success", <div class="<%= flash[:notification_banner_two_thirds] ? "govuk-grid-column-two-thirds-from-desktop" : "govuk-grid-column-full" %>">
success: true, title_heading_level: 3, <%= notification_banner %>
title_id: "flash-notice", </div>
role: "alert" </div>
) 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 %> <% end %>
<%= content_for?(:content) ? yield(:content) : yield %> <%= content_for?(:content) ? yield(:content) : yield %>
</main> </main>

Loading…
Cancel
Save