Module: SimpleModelView::TemplateHelpers
- Included in:
- ActionViewHelperBuilder, CollectionTableBuilder, CollectionTableHeaderBuilder, CollectionTableRowBuilder, ResourceTableBuilder
- Defined in:
- lib/simple_model_view/template_helpers.rb
Instance Method Summary collapse
Instance Method Details
#blank_span ⇒ Object
9 10 11 |
# File 'lib/simple_model_view/template_helpers.rb', line 9 def blank_span template.content_tag :span, I18n.t('simple_model_view.empty'), class: :empty end |
#block_concat ⇒ Object
5 6 7 |
# File 'lib/simple_model_view/template_helpers.rb', line 5 def block_concat template.concat yield end |
#merge_html_attrs(default, input) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/simple_model_view/template_helpers.rb', line 13 def merge_html_attrs(default, input) result = default.transform_keys(&:to_sym) input = input.transform_keys(&:to_sym) if result[:data].is_a?(Hash) && input[:data].is_a?(Hash) input[:data] = result[:data].merge(input[:data]) end if result[:class] && input[:class] input[:class] = [*default[:class], *input[:class]] end result.merge! input result.compact! result end |