Class: IndexFor::ListColumnBuilder

Inherits:
Builder
  • Object
show all
Defined in:
lib/index_for/builders/list_column_builder.rb

Instance Attribute Summary

Attributes inherited from Builder

#html_options, #object, #template

Instance Method Summary collapse

Methods inherited from Builder

#actions, #association, #attributes, #fields_for, #initialize

Constructor Details

This class inherits a constructor from IndexFor::Builder

Instance Method Details

#attribute(attribute_name, options = {}, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/index_for/builders/list_column_builder.rb', line 6

def attribute attribute_name, options = {}, &block
  label_options = options
  label_options[:html] = options[:label_html]
  label = list_label attribute_name, label_options

  content_options = options
  content_options[:html] = options[:content_html]
  content = list_content attribute_name, content_options, &block

  row_options = options
  row_options[:html] = options[:row_html]
  wrap_with :list_row, label + content, row_options
end

#list_content(attribute_name, options, &block) ⇒ Object



25
26
27
28
# File 'lib/index_for/builders/list_column_builder.rb', line 25

def list_content attribute_name, options, &block
  append_html_class options, attribute_class_name(attribute_name)
  wrap_attribute_with :list_content, attribute_name, options, &block
end

#list_label(attribute_name, options) ⇒ Object



20
21
22
23
# File 'lib/index_for/builders/list_column_builder.rb', line 20

def list_label attribute_name, options
  append_html_class options, attribute_class_name(attribute_name)
  wrap_with :list_label, attribute_label(attribute_name, options), options
end