Sha256: e3d748b7b80d7f40c26c4ce36d28a5d5b1f019f17b6d36bcbcffc2dbf07ff914
Contents?: true
Size: 812 Bytes
Versions: 8
Compression:
Stored size: 812 Bytes
Contents
module Renalware module DefinitionListHelper class DefinitionList < SimpleDelegator include ActionView::Helpers::TagHelper include ActionView::Helpers::TextHelper include ActionView::Context def initialize(model) @model_klass = model.class super(model) end def definition(attribute) text = @model_klass.human_attribute_name(attribute) value = public_send(attribute) value = yield(value) if value.present? && block_given? capture do concat content_tag(:dt, text) concat content_tag(:dd, value) end end end def definition_list_for(model, size: :large) content_tag(:dl, class: "dl-horizontal #{size}") do yield DefinitionList.new(model) end end end end
Version data entries
8 entries across 8 versions & 1 rubygems