<%= @section.name %>

<% if Cas::SectionConfig.new(@section).form_has_field?(:category) %> <%= link_to "Categorias", site_section_categories_path(@site, @section), id: 'manage-categories' %> <% end %>
<%= link_to 'Novo conteúdo', new_site_section_content_path(@site, @section), id: 'new-content' %>

<% @contents.each do |content| %> <% column_no = 1 %> <% Cas::SectionConfig.new(@section).list_fields.each do |field| %> <% end %> <% end %>
Título
<% if field == 'created_at' %> <% value = l(content.created_at, format: :short) %> <% elsif field == 'date_year' %> <% value = content.date.year %> <% elsif field == 'date' %> <% value = content.date.strftime("%d/%m/%Y") %> <% elsif field == 'date_time' %> <% if content.date.present? %> <% value = l(content.date, format: :short) %> <% end %> <% else %> <% value = content.public_send(field) %> <% end %> <% if column_no == 1 %> <%= link_to value, edit_site_section_content_path(@site, @section, content), id: "edit-content-#{content.id}" %> <% else %> <%= value %> <% end %> <% column_no += 1 %> <%= link_to 'Excluir', site_section_content_path(@site, @section, content), method: :delete, data: { confirm: 'Tem certeza?' }, id: "delete-content-#{content.id}" %>

<%= paginate @contents %>