Class: Opensteam::Helpers::ConfigTableHelper::Base
- Inherits:
-
ActionView::Base
- Object
- ActionView::Base
- Opensteam::Helpers::ConfigTableHelper::Base
- Includes:
- ActionView::Helpers::FormTagHelper, ActionView::Helpers::TagHelper
- Defined in:
- lib/opensteam/helpers/config_table_helper.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
-
#default_include ⇒ Object
Returns the value of attribute default_include.
-
#name ⇒ Object
Returns the value of attribute name.
-
#order_column ⇒ Object
Returns the value of attribute order_column.
Instance Method Summary collapse
- #[](id) ⇒ Object
- #column(id, *args) ⇒ Object
- #default_order_column(id) ⇒ Object
- #include_associations(arr) ⇒ Object
-
#initialize(name, *args) ⇒ Base
constructor
A new instance of Base.
- #table_header(&block) ⇒ Object
Constructor Details
#initialize(name, *args) ⇒ Base
Returns a new instance of Base.
55 56 57 58 59 60 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 55 def initialize( name, *args ) # args = args.first if args.is_a?(Array) @name = name @default_include = [] #args[:default_include] || [] @columns = [] end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
53 54 55 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 53 def columns @columns end |
#default_include ⇒ Object
Returns the value of attribute default_include.
53 54 55 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 53 def default_include @default_include end |
#name ⇒ Object
Returns the value of attribute name.
53 54 55 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 53 def name @name end |
#order_column ⇒ Object
Returns the value of attribute order_column.
53 54 55 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 53 def order_column @order_column end |
Instance Method Details
#[](id) ⇒ Object
74 75 76 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 74 def [](id) @columns.find { |s| s.id.to_s == id.to_s } end |
#column(id, *args) ⇒ Object
66 67 68 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 66 def column(id, *args) @columns << Column.new( id, *args ) end |
#default_order_column(id) ⇒ Object
70 71 72 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 70 def default_order_column(id) @order_column = id end |
#include_associations(arr) ⇒ Object
62 63 64 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 62 def include_associations(arr) @default_include = arr end |
#table_header(&block) ⇒ Object
78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/opensteam/helpers/config_table_helper.rb', line 78 def table_header( &block ) = {} content_tag( :thead, {} ) do content_tag( :tr, ) do @columns.collect do |c| content_tag( :th, {} ) do block.call( c ) end end end end end |