diff --git a/app/views/templates/_submission.html.erb b/app/views/templates/_submission.html.erb index 31ee04fa..e24e5eed 100644 --- a/app/views/templates/_submission.html.erb +++ b/app/views/templates/_submission.html.erb @@ -82,7 +82,7 @@ <% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %> - <%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> + <%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %> <% end %> <% if local_assigns[:archived] && can?(:destroy, submission) %> @@ -178,7 +178,7 @@ <% if !submission.archived_at? && !template.archived_at? %> - <%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, data: { turbo_confirm: 'Are you sure?' }, onclick: 'event.stopPropagation()' %> + <%= button_to button_title(title: nil, disabled_with: 'Arch', icon: svg_icon('archive', class: 'w-6 h-6')), submission_path(submission), class: 'btn btn-outline btn-sm w-full md:w-fit', form: { class: 'flex' }, title: 'Archive', method: :delete, onclick: 'event.stopPropagation()' %> <% end %> diff --git a/app/views/templates/_template.html.erb b/app/views/templates/_template.html.erb index 18543244..be820989 100644 --- a/app/views/templates/_template.html.erb +++ b/app/views/templates/_template.html.erb @@ -57,7 +57,7 @@ <% end %> <% if can?(:destroy, template) %> - <%= button_to template_path(template), data: { turbo_confirm: template.archived_at? ? 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' : 'Are you sure?' }, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %> + <%= button_to template_path(template), data: template.archived_at? ? { turbo_confirm: 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' } : {}, params: { permanently: template.archived_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %> <%= svg_icon(template.archived_at? ? 'trash' : 'archive', class: 'w-4 h-4 enabled') %> <%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %> <% end %> diff --git a/spec/system/template_spec.rb b/spec/system/template_spec.rb index 76f4a42d..72f09331 100644 --- a/spec/system/template_spec.rb +++ b/spec/system/template_spec.rb @@ -44,9 +44,7 @@ RSpec.describe 'Template' do it 'archives a template' do expect do - accept_confirm('Are you sure?') do - click_button 'Archive' - end + click_button 'Archive' end.to change { Template.active.count }.by(-1) expect(page).to have_content('Template has been archived')