Sha256: 351d5ffe3623c3a6f6ceb3a73752004f0c06ef6ba6491d41db176292feb773c5

Contents?: true

Size: 1.37 KB

Versions: 10

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true

module Decidim
  module DecidimAwesome
    module Admin
      # Global configuration controller
      class ProposalCustomFieldsController < DecidimAwesome::Admin::ConfigController
        def create
          CreateProposalCustomField.call(current_organization) do
            on(:ok) do |key|
              flash[:notice] = I18n.t("config.create_proposal_custom_field.success", key: key, scope: "decidim.decidim_awesome.admin")
            end

            on(:invalid) do |message|
              flash[:alert] = I18n.t("config.create_proposal_custom_field.error", error: message, scope: "decidim.decidim_awesome.admin")
            end
          end

          redirect_to decidim_admin_decidim_awesome.config_path(:proposal_custom_fields)
        end

        def destroy
          DestroyProposalCustomField.call(params[:key], current_organization) do
            on(:ok) do |key|
              flash[:notice] = I18n.t("config.destroy_proposal_custom_field.success", key: key, scope: "decidim.decidim_awesome.admin")
            end

            on(:invalid) do |message|
              flash[:alert] = I18n.t("config.destroy_proposal_custom_field.error", error: message, scope: "decidim.decidim_awesome.admin")
            end
          end

          redirect_to decidim_admin_decidim_awesome.config_path(:proposal_custom_fields)
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
decidim-decidim_awesome-0.10.2 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.10.1 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.10.0 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.9.3 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.9.1 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.8.3 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.8.2 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.8.1 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.8.0 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb
decidim-decidim_awesome-0.7.2 app/controllers/decidim/decidim_awesome/admin/proposal_custom_fields_controller.rb