Sha256: 8eece4ce5cec6e1c28635f953bfd8d09412a48daddcb9a9a1e2ff0a44efc08b8

Contents?: true

Size: 962 Bytes

Versions: 10

Compression:

Stored size: 962 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # This controller allows admins to manage proposals in a participatory process.
    class ExportsController < ApplicationController
      include Concerns::ParticipatoryProcessAdmin

      def create
        authorize! :manage, feature
        name = params[:id]

        ExportJob.perform_later(current_user, feature, name, params[:format] || default_format)

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

        redirect_back(fallback_location: fallback_location)
      end

      private

      def fallback_location
        send(
          "decidim_admin_#{feature.manifest.name}_path",
          feature_id: feature.id,
          participatory_process_id: participatory_process.id
        )
      end

      def default_format
        "json"
      end

      def feature
        @feature ||= participatory_process.features.find(params[:feature_id])
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
decidim-admin-0.4.0 app/controllers/decidim/admin/exports_controller.rb
decidim-0.4.0 decidim-admin/app/controllers/decidim/admin/exports_controller.rb
decidim-admin-0.3.2 app/controllers/decidim/admin/exports_controller.rb
decidim-0.3.2 decidim-admin/app/controllers/decidim/admin/exports_controller.rb
decidim-admin-0.3.1 app/controllers/decidim/admin/exports_controller.rb
decidim-0.3.1 decidim-admin/app/controllers/decidim/admin/exports_controller.rb
decidim-admin-0.3.0 app/controllers/decidim/admin/exports_controller.rb
decidim-0.3.0 decidim-admin/app/controllers/decidim/admin/exports_controller.rb
decidim-admin-0.2.0 app/controllers/decidim/admin/exports_controller.rb
decidim-0.2.0 decidim-admin/app/controllers/decidim/admin/exports_controller.rb