Sha256: 1739705f000e13692d2bbd32ee97081b1898931807a6a03b7250f04837df445f
Contents?: true
Size: 676 Bytes
Versions: 1
Compression:
Stored size: 676 Bytes
Contents
require "action_view" require "htmlentities" module Govspeak class EmbedPresenter include ActionView::Helpers::TagHelper attr_reader :embed def initialize(embed) @embed = ActiveSupport::HashWithIndifferentAccess.new(embed) end def content_id embed[:content_id] end def document_type embed[:document_type] end def render body = if document_type == "content_block_email_address" embed.dig(:details, :email_address) else embed[:title] end content_tag(:span, body, class: "embed embed-#{document_type}", id: "embed_#{content_id}") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
govspeak-8.5.0 | lib/govspeak/presenters/embed_presenter.rb |