|
|
|
|
@ -66,40 +66,48 @@
|
|
|
|
|
<%= 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 flex-1', data: { turbo_frame: :modal } do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('copy', class: 'w-6 h-6') %>
|
|
|
|
|
<span class="inline"><%= t('clone') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !template.archived_at? %>
|
|
|
|
|
<% if can?(:update, template) %>
|
|
|
|
|
<%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<%= link_to new_template_clone_path(template), class: 'btn btn-outline btn-sm w-full', data: { turbo_frame: :modal } do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('pencil', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('edit') %></span>
|
|
|
|
|
<%= svg_icon('copy', class: 'w-6 h-6') %>
|
|
|
|
|
<span class="inline"><%= t('clone') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
<% if !template.archived_at? %>
|
|
|
|
|
<% if can?(:update, template) %>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<%= link_to edit_template_path(template), class: 'btn btn-outline btn-sm w-full' do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('pencil', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('edit') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% elsif can?(:read, template) && !template.archived_at? %>
|
|
|
|
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('preview') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('preview') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% 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 flex-1' %>
|
|
|
|
|
<% end %>
|
|
|
|
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm flex-1' do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('preview') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<%= 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 %>
|
|
|
|
|
<div class="flex-1">
|
|
|
|
|
<%= link_to template_preview_path(template), class: 'btn btn-outline btn-sm w-full' do %>
|
|
|
|
|
<span class="flex items-center justify-center space-x-2">
|
|
|
|
|
<%= svg_icon('file_text', class: 'w-6 h-6') %>
|
|
|
|
|
<span><%= t('preview') %></span>
|
|
|
|
|
</span>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
<% end %>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|