Module: Fae::NestedFormHelper
- Defined in:
- app/helpers/fae/nested_form_helper.rb
Instance Method Summary collapse
Instance Method Details
#td_columns(params) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/helpers/fae/nested_form_helper.rb', line 17 def td_columns(params) attribute = params[:col] attributes = params[:cols] item = params[:item] attribute = (attribute.is_a?(Hash) && attribute[:attr]) ? attribute[:attr] : attribute first_attribute = (attributes.first.kind_of?(Hash) && attributes.first[:attr]) ? attributes.first[:attr] : attributes.first if attribute == first_attribute && !params[:edit_column] content_tag(:td) do content_tag(:a, class: 'js-edit-link', href: self.send(params[:edit_path], item)) do col_name_or_image(item, attribute) end end elsif item.class.columns_hash[attribute.to_s].present? && item.class.columns_hash[attribute.to_s].type == :boolean content_tag(:td) do attr_toggle(item, attribute) end else content_tag(:td) do col_name_or_image(item, attribute) end end end |
#th_columns(attribute) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/helpers/fae/nested_form_helper.rb', line 4 def th_columns(attribute) if (attribute.is_a?(Hash) && attribute[:title]) attribute = attribute[:title] attribute_title = attribute else attribute = :modified if ['updated_at', 'modified_at'].include? attribute.to_s attribute_title = attribute.to_s.titleize end th_class = '-action-wide' if [:on_production, :on_prod, :on_stage, :updated_at, :created_at, :modified].include?(attribute) content_tag(:th, class: th_class) do attribute_title end end |