<% add_decidim_page_title(t(".title")) %>

<%= t ".title" %> <% if allowed_to?(:create, :template) %> <%= link_to t("actions.new_template", scope: "decidim.admin.templates"), [:new, :questionnaire_template], class: "button button__sm button__secondary new" %> <% end %>

<% if @templates.any? %>
<% @templates.each do |template| %> <% end %>
<%= t("template.name", scope: "decidim.models") %> <%= t("questionnaire_template.fields.title", scope: "decidim.models") %> <%= t("questionnaire_template.fields.questions", scope: "decidim.models") %> <%= t("template.fields.created_at", scope: "decidim.models") %>
<%= link_to translated_attribute(template.name), edit_questionnaire_template_path(template) %> <%= link_to translated_attribute(template.templatable.title), edit_questionnaire_path(template) %> <%= template.templatable.questions.count.to_i %> <%= l template.created_at, format: :long %> <% if allowed_to?(:update, :template, questionnaire_template: template) %> <%= icon_link_to "pencil-line", edit_questionnaire_template_path(template), t("actions.edit", scope: "decidim.admin"), class: "edit" %> <% end %> <% if allowed_to?(:copy, :template, questionnaire_template: template) %> <%= icon_link_to "file-copy-line", copy_questionnaire_template_path(template), t("actions.duplicate", scope: "decidim.admin"), method: :post %> <% end %> <% if allowed_to?(:destroy, :template, questionnaire_template: template) %> <%= icon_link_to "delete-bin-line", questionnaire_template_path(template), t("actions.destroy", scope: "decidim.admin"), method: :delete, data: { confirm: t(".confirm_delete") }, class: "action-icon--remove" %> <% end %>
<% else %> <%= t("templates.empty", scope: "decidim.admin") %> <% end %>