%= content_tag :tr, id: "record-#{record.id}" do %>
<%@crud_helper.index_fields.each do |att| %>
<% if !att[:visible_if].nil?%>
<% if ((att[:visible_if].class == Proc && !att[:visible_if].call(att)) || (att[:visible_if].class != Proc && !att[:visible_if])) %>
<% next %>
<% end %>
<% end %>
<% if record.send(att[:attribute]).present? or record.send(att[:attribute]).to_s == "false"%>
<% if @model.columns_hash[att[:attribute].to_s].present? && [:date, :datetime].include?(@model.columns_hash[att[:attribute].to_s].type)%>
<% if att[:date_format].present?%>
<%= record.send(att[:attribute]).strftime(att[:date_format]) %> |
<% else %>
<%= l record.send(att[:attribute]) %> |
<% end %>
<% elsif @model.reflect_on_association(att[:attribute]) && @model.reflect_on_association(att[:attribute]).macro != :belongs_to%>
<% record.send(att[:attribute]).each do |rec| %>
<%= rec.to_s %>
<% end %>
|
<% elsif record.send(att[:attribute]).respond_to?(:url) and record.send(att[:attribute]).url(:thumb) %>
<%= image_tag(record.send(att[:attribute]).url(:thumb)) %> |
<% else %>
<% if record.send(att[:attribute]).to_s == "false" or record.send(att[:attribute]).to_s == "true" %>
<%= record.send(att[:attribute]) ? "Sim" : "Não" %> |
<% else %>
<%= record.send(att[:attribute]).to_s %> |
<% end %>
<% end %>
<% else %>
|
<% end %>
<%end%>
<%@crud_helper.actions.each do |a|%>
<% if ((a[2].present? && a[2].call(record)) || !a[2].present?) %>
<%=a[1]%>
<% end %>
<% end %>
<%@crud_helper.actions_links.each do |name, options|%>
<% if options[:url].present? %>
<% if options[:wiselink].present? && options[:wiselink] %>
<%=name%>
<% else %>
<%=name%>
<% end %>
<% elsif options[:associacao].present? %>
<%=name%>
<% end %>
<% end %>
<%if @crud_helper.view_action && shold_view?(@crud_helper, record)%>
Visualizar
<% end %>
<%if @crud_helper.edit_action && shold_edit?(@crud_helper, record) %>
Editar
<% end %>
<%if @crud_helper.destroy_action && shold_destroy?(@crud_helper, record)%>
Excluir
<% end %>
|
<% end %>