Class: Decidim::Admin::ExportsController

Inherits:
ApplicationController show all
Includes:
ComponentPathHelper
Defined in:
decidim-admin/app/controllers/decidim/admin/exports_controller.rb

Overview

This controller allows admins to manage proposals in a participatory process.

Instance Method Summary collapse

Methods included from ComponentPathHelper

#can_be_managed?, #main_component_path, #main_component_url, #manage_component_path

Methods inherited from ApplicationController

#permission_class_chain, #permission_scope, #user_has_no_permission_path, #user_not_authorized_path

Methods included from Headers::HttpCachingDisabler

#disable_http_caching

Methods included from NeedsSnippets

#snippets

Methods included from RegistersPermissions

register_permissions

Methods included from NeedsOrganization

enhance_controller, extended, included

Instance Method Details

#createObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'decidim-admin/app/controllers/decidim/admin/exports_controller.rb', line 9

def create
  enforce_permission_to(:export, :component_data, component:)
  name = params[:id]

  Decidim.traceability.perform_action!("export_component", component, current_user, { name:, format: params[:format] || default_format }) do
    ExportJob.perform_later(current_user, component, name, params[:format] || default_format, params[:resource_id].presence)
  end

  flash[:notice] = t("decidim.admin.exports.notice")

  redirect_back(fallback_location: manage_component_path(component))
end