- content_for :title do
Liste des fichiers
- content_for :toolbar do
= link_to admin_new_item_by_category_path(category_id: @category.slug), class: 'btn btn-primary' do
%i.fa.fa-plus
Ajouter un fichier
= form_tag admin_items_path, method: 'get', html: {role: "form"} do
%p
.form-inline
= label_tag :group_id, 'Groupe', class: 'control-label'
= select_tag :group_id, options_for_select([['Tous', nil]] + Group.all.map{|g| [g.name, g.id]}, params[:group_id]), class: 'form-control'
= label_tag :search, 'Nom ou description', class: 'control-label'
= text_field_tag :search, params[:search], class: 'form-control'
= submit_tag "Rechercher", name: nil, class: "btn btn-primary"
= link_to "Tous", admin_items_path, {class: "btn btn-link"}
%table.table.table-striped
%tr
%th= Item.human_attribute_name(:name)
- if @category.restricted?
%th= Item.human_attribute_name(:group_ids)
%th= Item.human_attribute_name(:description)
%th Nombre d'achats
%th
- @items.each do |item|
%tr
%td= item.name
- if @category.restricted?
%td.groups= item.groups.map(&:name).join(', ')
%td= truncate_item_description(item.description)
%td= item.purchases.count
%td.actions
= link_to admin_item_purchases_path(item), class: 'btn btn-success' do
%i.fa.fa-euro
Achats
- if item.category.restricted? && !item.email_sent?
= link_to send_mail_admin_item_path(item), method: :put, 'data-confirm' => t('links.are_you_sure'), class: 'btn btn-warning' do
%i.fa.fa-envelope
Envoyer e-mail
= link_to edit_admin_item_path(item), class: 'btn btn-primary' do
%i.fa.fa-edit
= t('links.edit')
= link_to admin_item_path(item), method: :delete, 'data-confirm' => t('links.are_you_sure'), class: 'btn btn-danger' do
%i.fa.fa-times
= t('links.delete')
.text-center
= paginate @items