<% template.name.split(/(_)/).each do |item| %><%= item %><% end %> <% if template.archived_at? %> <%= t('archived') %> <% end %>

<%= render 'templates/access_icon', template: @template %>
<% if @template.account_id == current_account.id %> <% else %> <% end %>
<% if !template.archived_at? %>
<% if can?(:update, template) %> <% end %> <%= link_to template_share_link_path(template), class: 'absolute md:relative bottom-0 right-0 btn btn-xs md:btn-sm whitespace-nowrap btn-neutral text-white mt-1 px-2', data: { turbo_frame: :modal } do %> <%= svg_icon('link', class: 'w-4 h-4 md:w-6 md:h-6') %> <%= t('link') %> <% end %>
<% end %>
<% if !template.archived_at? && can?(:destroy, template) %> <%= button_to button_title(title: t('archive'), disabled_with: t('archiving')[..-4], title_class: 'inline', icon: svg_icon('archive', class: 'w-6 h-6')), template_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1', method: :delete %> <% end %> <% if can?(:create, current_account.templates.new(author: current_user)) %>
<%= link_to new_template_clone_path(template), class: 'btn btn-outline btn-sm w-full', data: { turbo_frame: :modal } do %> <%= svg_icon('copy', class: 'w-6 h-6') %> <%= t('clone') %> <% end %>
<% end %> <% if !template.archived_at? %> <% if can?(:update, template) %>
<%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm w-full' do %> <%= svg_icon('pencil', class: 'w-6 h-6') %> <%= t('edit') %> <% end %>
<% elsif can?(:read, template) && !template.archived_at? %>
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %> <%= svg_icon('file_text', class: 'w-6 h-6') %> <%= t('preview') %> <% end %>
<% end %> <% end %> <% if template.archived_at? %> <% if can?(:destroy, template) %> <%= button_to button_title(title: t('restore'), disabled_with: t('restoring')[..-4], icon: svg_icon('rotate', class: 'w-6 h-6')), template_restore_index_path(template), class: 'btn btn-outline btn-sm w-full', form_class: 'flex-1' %> <% end %>
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %> <%= svg_icon('file_text', class: 'w-6 h-6') %> <%= t('preview') %> <% end %>
<% end %>