Class: Decidim::DecidimAwesome::Admin::MaintenanceController

Inherits:
ApplicationController
  • Object
show all
Includes:
ActionView::Helpers::DateHelper, Admin::Filterable, MaintenanceContext, NeedsAwesomeConfig
Defined in:
app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb

Overview

System compatibility analyzer

Instance Method Summary collapse

Methods included from NeedsAwesomeConfig

extended, included

Methods inherited from ApplicationController

#permission_class_chain

Instance Method Details

#destroy_private_dataObject



33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb', line 33

def destroy_private_data
  if private_data && private_data.total.to_i.positive?
    Decidim::ActionLogger.log("destroy_private_data", current_user, resource, nil, count: private_data.total)

    Lock.new(current_organization).get!(resource)
    DestroyPrivateDataJob.set(wait: 1.second).perform_later(resource)
  end
  redirect_to decidim_admin_decidim_awesome.maintenance_path("private_data"),
              notice: I18n.t("destroying_private_data", scope: "decidim.decidim_awesome.admin.maintenance.private_data", title: present_private_data(resource).name)
end

#showObject



22
23
24
25
26
27
28
29
30
31
# File 'app/controllers/decidim/decidim_awesome/admin/maintenance_controller.rb', line 22

def show
  respond_to do |format|
    format.json do
      render json: private_data_finder.for(params[:resources].to_s.split(",")).map { |resource| present(resource) }
    end
    format.all do
      render :show
    end
  end
end