<%= I18n.t(field[:sf][:label]) %> |
<% if @model.columns_hash[field[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[field[:attribute].to_s].type) %>
<% if field[:date_format].present?%>
<%= l @record.send(field[:attribute]).strftime(field[:date_format]) if @record.send(field[:attribute]).present? %>
<% else %>
<%= l @record.send(field[:attribute]) if @record.send(field[:attribute]).present? %>
<% end %>
<% elsif association?(@model, field[:attribute]) && !belongs_to_association?(@model, field[:attribute]) && !has_one_association?(@model, field[:attribute]) %>
<% @record.send(field[:attribute]).each do |rec| %>
<% if field[:sf].present? && field[:sf][:label_method].present? %>
<% if possui_url?(rec, field[:sf][:label_method]) && deve_renderizar_imagem?(field[:sf]) %>
<% if deve_renderizar_imagem?(field[:sf]) %>
<%= render_field_file(rec.send(field[:sf][:label_method])) %>
<% else %>
<%= rec.send(field[:sf][:label_method]).url %>
<% end %>
<% else %>
<%= rec.send(field[:sf][:label_method]) %>
<% end %>
<% else %>
<% if rec.respond_to?(:url) && deve_renderizar_imagem?(field[:sf]) %>
<%= render_field_file(rec.to_s) %>
<% else %>
<%= rec.to_s %>
<% end %>
<% end %>
<% end %>
<% elsif array?(@record, field[:attribute]) %>
<% @record.send(field[:attribute]).each do |rec| %>
<%= rec.to_s %>
<% end %>
<% elsif possui_url?(@record, field[:attribute]) %>
<% if deve_renderizar_imagem?(field[:sf]) %>
<%= render_field_file(@record.send(field[:attribute])) %>
<% else %>
<%= @record.send(field[:attribute]).url %>
<% end %>
<% elsif boolean?(@record, field[:attribute]) %>
<%= I18n.t(@record.send(field[:attribute]) ? "shared.sim" : "shared.nao") %>
<% else %>
<% if field[:sf].present? && field[:sf][:label_method].present? && @record.send(field[:attribute]).present?%>
<%= @record.send(field[:attribute]).send(field[:sf][:label_method]) %>
<% else %>
<%= @record.send(field[:attribute]) %>
<% end %>
<% end %>
|
<% end %>