allow to permanently delete template in the cloud
This commit is contained in:
@@ -58,9 +58,11 @@ class TemplatesController < ApplicationController
|
|||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
notice =
|
notice =
|
||||||
if !Docuseal.multitenant? && params[:permanently].present?
|
if params[:permanently].present?
|
||||||
@template.destroy!
|
@template.destroy!
|
||||||
|
|
||||||
|
Rollbar.info("Remove template: #{@template.id}") if defined?(Rollbar)
|
||||||
|
|
||||||
'Template has been removed.'
|
'Template has been removed.'
|
||||||
else
|
else
|
||||||
@template.update!(deleted_at: Time.current)
|
@template.update!(deleted_at: Time.current)
|
||||||
|
|||||||
@@ -52,9 +52,9 @@
|
|||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if (!template.deleted_at? || !Docuseal.multitenant?) && can?(:destroy, template) %>
|
<% if can?(:destroy, template) %>
|
||||||
<span class="tooltip tooltip-left" data-tip="<%= template.deleted_at? ? 'Remove' : 'Archive' %>">
|
<span class="tooltip tooltip-left" data-tip="<%= template.deleted_at? ? 'Delete' : 'Archive' %>">
|
||||||
<%= button_to template_path(template), data: { turbo_confirm: 'Are you sure?' }, params: { permanently: template.deleted_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: { turbo_confirm: template.deleted_at? ? 'Template deletion is irreversible and will permanently remove all associated signed documents with it. Are you sure?' : 'Are you sure?' }, params: { permanently: template.deleted_at? }.compact_blank, method: :delete, class: 'btn btn-xs hover:btn-outline bg-base-200 btn-circle', aria_label: 'Restore' do %>
|
||||||
<%= svg_icon('trash', class: 'w-4 h-4 enabled') %>
|
<%= svg_icon('trash', class: 'w-4 h-4 enabled') %>
|
||||||
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
|
<%= svg_icon('loader', class: 'w-4 h-4 animate-spin disabled') %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
Reference in New Issue
Block a user