Sha256: a42d6ada05449c59f52f46c5559f245f25992a842834cdd5ac46fa91735ea691

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 KB

Contents

<%#
# Index

This view is the template for the index page.
It is responsible for rendering the search bar, header and pagination.
It renders the `_table` partial to display details about the resources.

## Local variables:

- `page`:
  An instance of [Administrate::Page::Collection][1].
  Contains helper methods to help display a table,
  and knows which attributes should be displayed in the resource's table.
- `resources`:
  An instance of `ActiveRecord::Relation` containing the resources
  that match the user's search criteria.
  By default, these resources are passed to the table partial to be displayed.
- `search_term`:
  A string containing the term the user has searched for, if any.
- `show_search_bar`:
  A boolean that determines if the search bar should be shown.

[1]: http://www.rubydoc.info/gems/administrate/Administrate/Page/Collection
%>

<% content_for(:title) do %>
  <%= display_resource_name(page.resource_name) %>
<% end %>

<header class="main-content__header" role="banner">
  <h1 class="main-content__page-title" id="page-title">
    <%= content_for(:title) %>
  </h1>

  <% if show_search_bar %>
    <div class="main-content__search">
      <%= render(
        "search",
        search_term: search_term,
        resource_name: display_resource_name(page.resource_name)
      ) %>
    </div>
  <% end %>

  <div class="main-content__navs">
    <%= link_to(
      t(
        "administrate.actions.new_resource",
        name: page.resource_name.titleize.downcase
      ),
      [:new, namespace, page.resource_path],
      class: "button",
    ) if valid_action?(:new) && show_action?(:new, new_resource) %>
  </div>
</header>

<section class="main-content__body">
  <%= render(
    "collection",
    collection_presenter: page,
    collection_field_name: resource_name,
    page: page,
    resources: resources,
    table_title: "page-title"
  ) %>

  <%= paginate resources %>
</section>

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
semantic-administrate-0.10.1 app/views/administrate/application/index.html.erb
semantic-administrate-0.10.0 app/views/administrate/application/index.html.erb