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, fae_toggle(item, attribute))
else
content_tag(:td, col_name_or_image(item, attribute))
end
end
|