<%= render_crud do %>
<% @crud_helper.view_fields.each do |field|%> <% if field[:sf].present? && !field[:sf][:visible_if].nil?%> <% if ((field[:sf][:visible_if].class == Proc && !field[:sf][:visible_if].call(@record)) || (field[:sf][:visible_if].class != Proc && !field[:sf][:visible_if])) %> <% next %> <% end %> <% end %> <% if field[:sf].present? && field[:sf][:label].present? %> <% else %> <% end %> <% 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?%> <% else %> <% end %> <% elsif @model.reflect_on_association(field[:attribute]) && @model.reflect_on_association(field[:attribute]).macro != :belongs_to && @model.reflect_on_association(field[:attribute]).macro != :has_one%> <% elsif @record.send(field[:attribute]).class == Array %> <% elsif @record.send(field[:attribute]).respond_to?(:url) %> <% elsif ["false","true"].include? @record.send(field[:attribute]).to_s %> <% else %> <% end %> <% end %>
<%= field[:sf][:label].to_s.mb_chars.upcase.to_s %><%= field[:attribute].to_s.mb_chars.upcase.to_s %><%= l @record.send(field[:attribute]).strftime(field[:date_format]) if @record.send(field[:attribute]).present?%><%= l @record.send(field[:attribute]) if @record.send(field[:attribute]).present?%> <% @record.send(field[:attribute]).each do |rec| %>
  • <% if field[:sf].present? && field[:sf][:label_method].present? %> <% if rec.send(field[:sf][:label_method]).respond_to?(:url) %> <%= render_field_file(rec.send(field[:sf][:label_method])) %> <% else %> <%= rec.send(field[:sf][:label_method]) %> <% end %> <% else %> <% if rec.to_s.respond_to?(:url) %> <%= render_field_file(rec.to_s) %> <% else %> <%= rec.to_s %> <% end %> <% end %>
  • <% end %>
    <% @record.send(field[:attribute]).each do |rec| %>
  • <%= rec.to_s %>
  • <% end %>
    <%= render_field_file(@record.send(field[:attribute])) %> <%= @record.send(field[:attribute]) ? "Sim" : "Não" %> <% 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 %>

    <%= link_to "Voltar", @url ,class: 'btn btn-default', data: {push: 'partial', target: "#form"} %> <% end %>