app/views/certificate_templates/index.html.haml
- provide(:title, t('.title'))
.row
.col-xs-12
%h1.text-center=t('.title')
.col-xs-12.col-sm-8.col-sm-offset-2.vert-offset-top-1.text-right
= link_to_new current_person.can_act?('certificate_template:new'), new_certificate_template_path
.col-xs-12.col-sm-8.col-sm-offset-2.vert-offset-top-1
.table-responsive
%table.table.table-condensed.table-striped
%thead
%tr
%th.text-top=t('.id')
%th.text-top=t('.template_title')
%th.text-top=t('.certificates_count')
- if @certificate_templates.any? { |c| policy(c).tap { |p| break p.edit? || p.destroy? } }
%th.text-top.text-right=t('.actions')
%tbody
- @certificate_templates.each do |certificate_template|
%tr
%td
= certificate_template.id
%td
= certificate_template.title
%td.text-center
= link_to_if !certificate_template.certificates_count.zero?, certificate_template.certificates_count, certificate_template_certificates_path(certificate_template) do
= certificate_template.certificates_count
- if policy(certificate_template).tap { |p| break p.edit? || p.destroy? }
%td.col-xs-2.col-sm-4.col-md-3.text-right
= link_to_copy current_person.can_act?('certificate_template:new'),
certificate_template_copy_path(certificate_template)
= link_to_edit policy(certificate_template).edit?,
edit_certificate_template_path(certificate_template)
= link_to_destroy policy(certificate_template).destroy?, certificate_template