archive without confirm
This commit is contained in:
@@ -82,7 +82,7 @@
|
||||
</div>
|
||||
<% if !submission.archived_at? && !template.archived_at? && can?(:destroy, submission) %>
|
||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||
<%= 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()' %>
|
||||
</span>
|
||||
<% end %>
|
||||
<% if local_assigns[:archived] && can?(:destroy, submission) %>
|
||||
@@ -178,7 +178,7 @@
|
||||
</div>
|
||||
<% if !submission.archived_at? && !template.archived_at? %>
|
||||
<span data-tip="Archive" class="sm:tooltip tooltip-top">
|
||||
<%= 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()' %>
|
||||
</span>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<% end %>
|
||||
<% if can?(:destroy, template) %>
|
||||
<span class="tooltip tooltip-left" data-tip="<%= template.archived_at? ? 'Delete' : 'Archive' %>">
|
||||
<%= 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 %>
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user