Sha256: 99dd125891cd6ad6540856674d915d8115db1c36166db0e6701853aeacd662a8
Contents?: true
Size: 1.09 KB
Versions: 93
Compression:
Stored size: 1.09 KB
Contents
module GovukPublishingComponents module Presenters class InterventionHelper def initialize(local_assigns) @accessible_text_suffix = I18n.t("components.intervention.accessible_link_text_suffix") @query_string = local_assigns[:query_string] @suggestion_link_text = local_assigns[:suggestion_link_text] @suggestion_link_url = local_assigns[:suggestion_link_url] end def accessible_text @suggestion_link_text << @accessible_text_suffix unless @suggestion_link_text.include?(@accessible_text_suffix) @suggestion_link_text end def dismiss_link if @query_string.present? "#{@query_string}&hide-intervention=true" else "?hide-intervention=true" end end def security_attr rel = "noopener noreferrer" rel << " external" unless @suggestion_link_url.start_with?("/", "https://gov.uk", "https://www.gov.uk") rel end private attr_reader :accessible_text_suffix, :query_string, :suggestion_link_text, :suggestion_link_url end end end
Version data entries
93 entries across 93 versions & 1 rubygems