%
page_title = @resource.model_name.human(count: 2)
admin_title(page_title)
%>
<% content_for :main_grid do %>
<%= render 'index' %>
<%= page_title %>
<%= admin_search %>
<%= admin_display_flash_message %>
<% if @resource.typus_options_for(:counters) || @resource.typus_scopes.any? || predefined_filters.any? %>
<% all_klass = params[:scope] ? "inactive" : "active" %>
-
<%= link_to url_for(params.dup.cleanup.merge(:action => 'index')) do %>
<%= Typus::I18n.t("All") %>
<% if @resource.typus_options_for(:counters) %>
<%= " #{resource.count}".html_safe %>
<% end %>
<% end %>
<% @resource.typus_scopes.each do |scope| %>
<% klass = params[:scope].eql?(scope) ? "active" : "inactive" %>
-
<%= link_to url_for(:scope => scope) do %>
<%= Typus::I18n.t(scope, scope: "typus.scopes.#{@resource.model_name.singular}") %>
<% if @resource.typus_options_for(:counters) %>
<%= " #{@resource.send(scope).count}".html_safe %>
<% end %>
<% end %>
<% end %>
<% predefined_filters.each do |filter, action, scope| %>
-
<% url = action.is_a?(String) ? params.dup.cleanup.merge(:action => action) : action %>
<%= link_to url do %>
<%= Typus::I18n.t(filter) %>
<% if @resource.typus_options_for(:counters) && scope && @resource.respond_to?(scope) %>
<%= " #{@resource.send(scope).count}".html_safe %>
<% end %>
<% end %>
<% end %>
<% show_export_formats = (resource.any? && (formats = resource.typus_options_for(:export).extract_settings).any?) %>
<% if show_export_formats %>
<% formats.each do |format| %>
- <%= link_to format.upcase, :format => format, scope: params[:scope] %>
<% end %>
<% end %>
<% end %>
<%= build_filters %>
<% if @items.any? -%>
<% if controller.respond_to?(:bulk) %>
<%= build_actions { build_list(@resource, fields, @items) } %>
<% else %>
<%= build_list(@resource, fields, @items) %>
<% end %>
<%= admin_paginate %>
<% else %>
<%= Typus::I18n.t("No entries found.") %>
<% end %>
<% end %>