Class: UnorderedListResourceRenderer

Inherits:
ResourceRenderer::ResourceRenderer::Base show all
Defined in:
app/resource_renderers/unordered_list_resource_renderer.rb

Instance Attribute Summary

Attributes inherited from ResourceRenderer::ResourceRenderer::Base

#helper, #resource

Instance Method Summary collapse

Methods inherited from ResourceRenderer::ResourceRenderer::Base

#association, #initialize, #resource_class

Constructor Details

This class inherits a constructor from ResourceRenderer::ResourceRenderer::Base

Instance Method Details

#display(attribute_name, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'app/resource_renderers/unordered_list_resource_renderer.rb', line 2

def display(attribute_name, options = {})
  options.reverse_merge!(html_options: default_html_options_for(attribute_name))

  html_options = options.delete(:html_options)
  helper.(:li, html_options) do
    helper.(:span, translated_attribute_name(attribute_name), class: 'key') + 
    helper.(:span, attribute_value(attribute_name), class: 'value')
  end
end

#render(&block) ⇒ Object



12
13
14
15
16
# File 'app/resource_renderers/unordered_list_resource_renderer.rb', line 12

def render(&block)
  helper.(:ul) do
    block.call(self)
  end
end