Sha256: bb12d7e9f24c72a8949bc7931f7e9a9247b51445662e905d73a0cd1bc7e41798

Contents?: true

Size: 1.93 KB

Versions: 3

Compression:

Stored size: 1.93 KB

Contents

<div class="grid">
  <div class="col-1-2">
    <h1><%= @section.name %></h1>
  </div>
  <div class="col-1-2 section-options">
    <% if Cas::SectionConfig.new(@section).form_has_field?(:category) %>
      <%= link_to "Categorias", site_section_categories_path(@site, @section), id: 'manage-categories' %>
    <% end %>
  </div>
</div>

<%= link_to 'Novo conteúdo',
  new_site_section_content_path(@site, @section),
  id: 'new-content' %>

<br />
<br />

<table>
  <thead>
    <tr>
      <th colspan="<%= Cas::SectionConfig.new(@section).list_fields.count %>">Título</th>
      <th></th>
    </tr>
  </thead>

  <tbody>
  <% @contents.each do |content| %>
    <tr id="content-<%= content.id %>">
      <% column_no = 1 %>

      <% Cas::SectionConfig.new(@section).list_fields.each do |field| %>
        <td>
          <% 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 %>
        </td>
      <% end %>
      <td>
        <%= link_to 'Excluir', site_section_content_path(@site, @section, content),
          method: :delete,
          data: { confirm: 'Tem certeza?' },
          id: "delete-content-#{content.id}" %>
      </td>
    </tr>
  <% end %>
  </tbody>
</table>
<br>

<%= paginate @contents %>

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cas-cms-0.1.3 app/views/cas/sites/sections/contents/index.html.erb
cas-cms-0.1.2 app/views/cas/sites/sections/contents/index.html.erb
cas-cms-0.1.1 app/views/cas/sites/sections/contents/index.html.erb