Test mass actions in admin

This commit is contained in:
Karl Erik Õunapuu 2020-11-05 14:16:37 +02:00
parent d80007d83c
commit 1a0becf785
No known key found for this signature in database
GPG key ID: C9DD647298A34764
7 changed files with 40 additions and 9 deletions

View file

@ -1,3 +0,0 @@
$('input:file').on("change", function() {
$('input:submit').prop('disabled', !$(this).val());
});

View file

@ -2,10 +2,11 @@
module Admin
class MassActionsController < BaseController
authorize_resource
before_action :authorize_admin
# GET /admin/mass_actions
def index; end
def index
end
# POST /admin/mass_actions
def create
@ -19,5 +20,9 @@ module Admin
redirect_to(admin_mass_actions_path, notice: notice)
end
def authorize_admin
authorize! :manage, :mass_actions
end
end
end

View file

@ -109,7 +109,7 @@ class Ability
can :destroy, :pending
can :create, :zonefile
can :access, :settings_menu
can :manage, MassAction
can :manage, :mass_actions
end
def static_registrant

View file

@ -7,11 +7,13 @@
<div class="panel-body">
<p>Triggers <b>soft</b> force delete procedure for uploaded domain list. List must be in <b>CSV</b> format. Each domain entry must be on separate line. Line must include <b>domain_name</b> (puny) followed with <b>delete_reason</b>, separated by comma.</p>
<p>Allowed delete reasons: <b>ENTITY_BURIED</b> | <b>PHONE</b> | <b>EMAIL</b></p>
<%= form_tag admin_mass_actions_path, multipart: true do %>
<%= file_field_tag :entry_list, accept: 'text/csv' %>
<%= form_tag admin_mass_actions_path, multipart: true, method: :post do %>
<%= label_tag :entry_list %>
<%= file_field_tag :entry_list, required: true, accept: 'text/csv' %>
<%= hidden_field_tag :mass_action, 'force_delete' %>
<%= hidden_field_tag :authenticity_token, form_authenticity_token %>
<br>
<%= submit_tag "Start force delete process", class: 'btn btn-danger', disabled: true %>
<%= submit_tag "Start force delete process", class: 'btn btn-danger', id: 'fd_submit' %>
<% end %>
</div>
</div>