Sha256: 5becb3373cb74840c97d0e72b18f1924b45eb62f3fbed44c09f5d440134197cd
Contents?: true
Size: 811 Bytes
Versions: 27
Compression:
Stored size: 811 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
27 entries across 27 versions & 1 rubygems