class Syaso::List

Constants

ITEM_VIEW

Public Class Methods

new(context, content) click to toggle source

initialize instance

@param [ActionView] context @param [Array] content

Calls superclass method Syaso::Base::new
# File lib/syaso/list.rb, line 16
def initialize(context, content)
  super(context)
  self.content = content
end

Public Instance Methods

each(options = {}) { |item_view| ... } click to toggle source

render container and iterate items

@param [Hash] options

# File lib/syaso/list.rb, line 34
def each(options = {}, &block)
  self._render(options) do |v|
    self.content.each do |i|
      yield(self.item_view(i))
    end
  end
end
render(options = {}, &block) click to toggle source

render list

@param [Hash] options

# File lib/syaso/list.rb, line 24
def render(options = {}, &block)
  ops = options.delete(:item)||{}
  self.each(options) do |i|
    i.render(ops, &block)
  end
end

Protected Instance Methods

default_html_class() click to toggle source

default html class

# File lib/syaso/list.rb, line 60
def default_html_class
  [:list]
end
default_html_tag() click to toggle source

default html tag

@return [Symbol]

# File lib/syaso/list.rb, line 55
def default_html_tag
  :ul
end
item_view(item) click to toggle source

item view

@param [Object] item

# File lib/syaso/list.rb, line 48
def item_view(item)
  ITEM_VIEW.new(self.context, self, item)
end