Add both types of delete procedure to the view/controller

This commit is contained in:
Alex Sherman 2019-12-05 12:12:49 +05:00
parent 0e1542609e
commit b9575661eb
3 changed files with 22 additions and 1 deletions

View file

@ -5,7 +5,7 @@ module Admin
authorize! :manage, domain
domain.transaction do
domain.schedule_force_delete
domain.schedule_force_delete(type: force_delete_type)
domain.registrar.notifications.create!(text: t('force_delete_set_on_domain',
domain_name: domain.name))
@ -35,6 +35,14 @@ module Admin
def notify_by_email?
ActiveRecord::Type::Boolean.new.cast(params[:notify_by_email])
end
def force_delete_type
soft_delete? ? :soft : :fast_track
end
def soft_delete?
ActiveRecord::Type::Boolean.new.cast(params[:soft_delete])
end
end
end
end

View file

@ -10,6 +10,18 @@
<%= form_tag admin_domain_force_delete_path(domain), id: 'domain-force-delete-form',
class: 'modal-body form-horizontal' do %>
<div class="form-group force-delete-type">
<div class="col-md-9">
<div class="checkbox">
<label>
<%= check_box_tag 'soft_delete', 1, true,
data: { dependent_content_toggle: true } %>
<%= t '.use_soft_delete' %>
</label>
</div>
</div>
</div>
<div class="form-group">
<div class="col-md-9">
<div class="checkbox">

View file

@ -31,6 +31,7 @@ en:
force_delete_dialog:
title: Force delete
notify_by_email: Notify registrant and administrative contacts by email
use_soft_delete: Use soft delete procedure
email_template: Email template
close_btn: Close dialog
submit_btn: Force delete domain