|
<%= m.id %> |
<% list_params.each do |attr| %>
<% if attr.is_a?(Hash) %>
<% if attr[attr.keys.first][:type].to_s == 'image' %>
<% if m.send(attr.keys.first).present? %>
<% else %>
<%= t('slash_admin.view.no_image') %>
<% end %>
|
<% else %>
<%= render attr.keys.first.to_s, model: m %> |
<% end %>
<% else %>
<% if m.send(attr).is_a?(TrueClass) || m.send(attr).is_a?(FalseClass) %>
<%= m.send(attr) ? 'Oui' : 'Non' %>
|
<% elsif @belongs_to_fields.include?(attr) || @has_one_fields.include?(attr) %>
<%= link_to(edit_polymorphic_url([:slash_admin, m.send(attr)]), class: 'link', target: '_blank') do %>
<%= show_object(m.send(attr)) %>
<% end rescue show_object(m.send(attr)) %>
|
<% elsif @has_many_fields.include?(attr) %>
<% if m.send(attr).length == 0 %>
<%= t('slash_admin.view.no_associations') %>
<% else %>
<% m.send(attr).each do |a| %>
<%= link_to(edit_polymorphic_url([:slash_admin, a]), class: 'link', target: '_blank') do %>
<%= show_object(a) %>
<% end rescue show_object(a) %>
<% end %>
<% end %>
|
<% else %>
<%= m.send(attr) %> |
<% end %>
<% end %>
<% end %>
<% if can? :show, @model_class %>
<%= link_to(polymorphic_url([:slash_admin, m]), class: 'btn btn-info btn-sm') do %>
<% end rescue nil %>
<% end %>
<% if can? :edit, @model_class %>
<%= link_to(edit_polymorphic_url([:slash_admin, m]), class: 'btn btn-warning btn-sm') do %>
<% end rescue nil %>
<% end %>
<% if can? :destroy, @model_class %>
<%= link_to(polymorphic_url([:slash_admin, m]), class: 'single-delete btn btn-danger btn-sm') do %>
<% end rescue nil %>
<% end %>
|
<% end %>