Sha256: e5697b6373236be999ad30e10e003fa50a03a70cf6f70681243be7672d569bb3

Contents?: true

Size: 1.85 KB

Versions: 6

Compression:

Stored size: 1.85 KB

Contents

<h1><%= @title %></h1>

<div>
  <p><%= link_to "New #{@title.singularize}", new_thing_path(@model_name), id: "new-#{@model_name}" %></p>
  <p><%= "There are no #{@human_model.downcase.pluralize} in the database." if @things.blank? %></p>
</div>

<table>
  <thead>
    <tr>
      <% unless @things.blank? %>
        <% @things.first.each_key do |heading| %>
          <th>
            <%= heading %>
          </th>
        <% end %>
      <% end %>
    </tr>
  </thead>

  <tbody>
    <% @things.each do |thing| %>
      <tr id="#{@controller_name}-#{thing.id}">
      <% thing.each do |heading, value| %>
        <td label="<%= heading %>: ">
          <%= value %>
        </td>

        <div class="actions">
          <td><%= link_to("Edit", edit_thing_path(@model_name, thing)) %></td>
          <td><%= link_to("Show", thing_path(@model_name, thing)) %></td>
        </div>
      <% end %>
      </tr>
    <% end %>
  </tbody>
</table>

<nav class="navigation" role="navigation">
  <ul>
    <% if @page == 1 %>
      <li><a>1</a></li>
    <% else %>
      <!-- First Page -->
      <li>
        <%= link_to('1', thing_page_path(@model_name, @page - 1)) %>
      </li>
    <% end %>

    <% if @page.to_i > 2 %>
      <!-- Previous Page -->
      <li>
        <%= link_to("#{@page - 1}", thing_page_path(@model_name, @page - 1)) %>
      </li>
    <% end %>

    <% unless @page == 1 %>
      <!-- Current Page -->
      <li>
        <a><%= @page %></a>
      </li>
    <% end %>

    <% if @page < @total_pages && @page + 1 < @total_pages %>
      <!-- Next Page -->
      <li>
        <%= link_to("#{@page + 1}", thing_page_path(@model_name, @page + 1)) %>
      </li>
    <% end %>

    <% unless @page == @total_pages %>
      <!-- Last Page -->
      <li>
        <%= link_to("#{@total_pages}", thing_page_path(@model_name, @total_pages)) %>
      </li>
    <% end %>
  </ul>
</nav>

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ceo-0.1.7 app/views/admin/index.html.erb
ceo-0.1.6 app/views/admin/index.html.erb
ceo-0.1.5 app/views/admin/index.html.erb
ceo-0.1.4 app/views/admin/index.html.erb
ceo-0.1.3 app/views/admin/index.html.erb
ceo-0.1.2 app/views/admin/index.html.erb