Class: ActiveAdmin::Views::Column
- Defined in:
- lib/active_admin/views/components/columns.rb
Instance Attribute Summary collapse
-
#max_width ⇒ Object
Returns the value of attribute max_width.
-
#min_width ⇒ Object
Returns the value of attribute min_width.
-
#span_size ⇒ Object
Returns the value of attribute span_size.
Instance Method Summary collapse
- #build(options = {}) ⇒ Object
- #set_column_styles(column_width, margin_width, is_last_column = false) ⇒ Object
Instance Attribute Details
#max_width ⇒ Object
Returns the value of attribute max_width.
119 120 121 |
# File 'lib/active_admin/views/components/columns.rb', line 119 def max_width @max_width end |
#min_width ⇒ Object
Returns the value of attribute min_width.
119 120 121 |
# File 'lib/active_admin/views/components/columns.rb', line 119 def min_width @min_width end |
#span_size ⇒ Object
Returns the value of attribute span_size.
119 120 121 |
# File 'lib/active_admin/views/components/columns.rb', line 119 def span_size @span_size end |
Instance Method Details
#build(options = {}) ⇒ Object
124 125 126 127 128 129 130 131 |
# File 'lib/active_admin/views/components/columns.rb', line 124 def build( = {}) = .dup @span_size = .delete(:span) || 1 @max_width = .delete(:max_width) @min_width = .delete(:min_width) super() end |
#set_column_styles(column_width, margin_width, is_last_column = false) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/active_admin/views/components/columns.rb', line 133 def set_column_styles(column_width, margin_width, is_last_column = false) column_with_span_width = (span_size * column_width) + ((span_size - 1) * margin_width) styles = [] styles << "width: #{column_with_span_width}%;" if max_width styles << "max-width: #{safe_width(max_width)};" end if min_width styles << "min-width: #{safe_width(min_width)};" end styles << "margin-right: #{margin_width}%;" unless is_last_column set_attribute :style, styles.join(" ") end |