From 59b5f039486ef891fee26ca0c183e2a081bf136d Mon Sep 17 00:00:00 2001 From: Pete Matsyburka Date: Sat, 29 Aug 2026 20:18:34 +0300 Subject: [PATCH] fix buttons order --- app/views/templates/_title.html.erb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app/views/templates/_title.html.erb b/app/views/templates/_title.html.erb index d9446ebd..02d6b3f4 100644 --- a/app/views/templates/_title.html.erb +++ b/app/views/templates/_title.html.erb @@ -64,8 +64,12 @@ <% 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 %> + <% if can?(:destroy, template) %> + <% if template.archived_at? %> + <%= 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' %> + <% else %> + <%= 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 %> <% end %> <% if can?(:create, current_account.templates.new(author: current_user)) %>
@@ -99,9 +103,6 @@ <% 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 %>