app/views/spree/admin/question_categories/index.html.erb
<% content_for :page_title do %>
<%= Spree::QuestionCategory.model_name.human(count: :many) %>
<% end %>
<% content_for :page_actions do %>
<%= button_link_to Spree.t(:new_question_category), new_admin_question_category_path, icon: 'add', class: 'btn btn-success', id: 'admin_new_question_category_link' %>
<% end %>
<% content_for :table_filter do %>
<div data-hook="admin_question_category_index_search">
<%= search_form_for [:admin, @search] do |f| %>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<%= label_tag :q_name_cont, Spree::QuestionCategory.human_attribute_name(:name) %>
<%= f.text_field :name_cont, class: 'form-control js-quick-search-target' %>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<!-- free space -->
</div>
</div>
</div>
<div class="form-actions" data-hook="admin_question_category_index_search_buttons">
<%= button Spree.t(:filter_results), 'search' %>
</div>
<% end %>
</div>
<% end %>
<%= render 'spree/admin/shared/index_table_options', collection: @question_categories %>
<% if @question_categories.any? %>
<table class="table" id="listing_question_categories">
<thead>
<tr data-hook="admin_question_category_index_headers">
<th><%= sort_link @search, :updated_at, Spree::QuestionCategory.human_attribute_name(:updated_at) %></th>
<th><%= sort_link @search, :name, Spree::QuestionCategory.human_attribute_name(:name) %></th>
<th class="text-center"><%= Spree::Question.model_name.human(count: :many) %></th>
<th data-hook="admin_question_category_index_header_actions" class="actions"></th>
</tr>
</thead>
<tbody>
<% @question_categories.each do |category| %>
<tr id="<%= spree_dom_id category %>" data-hook="admin_question_category_index_rows" class="<%= cycle('odd', 'even') %>">
<td><%= l category.updated_at, format: :short %></td>
<td><%= h category.name %></td>
<td class="text-center"><%= category.questions.try(:count) || 0 %></td>
<td data-hook="admin_question_category_index_row_actions" class="actions text-right">
<%= link_to_edit category, no_text: true %>
<%= link_to_delete category, no_text: true %>
</td>
</tr>
<% end %>
</tbody>
</table>
<% else %>
<div class="alert alert-warning no-objects-found">
<%= Spree.t(:no_resource_found, resource: Spree::QuestionCategory.model_name.human(count: :many)) %>,
<%= link_to Spree.t(:add_one), spree.new_admin_question_category_path %>!
</div>
<% end %>
<%= render 'spree/admin/shared/index_table_options', collection: @question_categories %>