Browse Source

Adjust notifications helper

pull/2613/head
Rachael Booth 2 years ago
parent
commit
f4223d2f97
  1. 16
      app/helpers/notifications_helper.rb

16
app/helpers/notifications_helper.rb

@ -16,20 +16,17 @@ module NotificationsHelper
end
def render_for_banner(title)
@@banner_renderer ||= NotificationTitleRenderer.new({ invert_link_colour: true, bold_all_text: true })
@@banner_markdown ||= Redcarpet::Markdown.new(@@banner_renderer, no_intra_emphasis: true)
@@banner_markdown.render(title)
banner_renderer ||= NotificationTitleRenderer.new({ invert_link_colour: true, bold_all_text: true })
Redcarpet::Markdown.new(banner_renderer, no_intra_emphasis: true).render(title)
end
def render_for_summary(title)
@@plain_title_renderer ||= NotificationTitleRenderer.new({ invert_link_colour: false, bold_all_text: false })
@@plain_title_markdown ||= Redcarpet::Markdown.new(@@plain_title_renderer, no_intra_emphasis: true)
@@plain_title_markdown.render(title)
plain_title_renderer ||= NotificationTitleRenderer.new({ invert_link_colour: false, bold_all_text: false })
Redcarpet::Markdown.new(plain_title_renderer, no_intra_emphasis: true).render(title)
end
end
private
class NotificationTitleRenderer < Redcarpet::Render::HTML
class NotificationTitleRenderer < Redcarpet::Render::HTML
def initialize(options = {})
link_class = "govuk-link"
link_class += " govuk-link--inverse" if options[:invert_link_colour]
@ -43,5 +40,4 @@ private
%(<p>#{text}</p>)
end
end
end

Loading…
Cancel
Save