Sha256: 7719148a99a8cac304a8a528d211e95c2349ae549b70a4e4ceb369c385fc79d0

Contents?: true

Size: 1.03 KB

Versions: 49

Compression:

Stored size: 1.03 KB

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module Admin
      # Controller that allows managing assemblies.
      #
      class AssemblyCopiesController < Decidim::Assemblies::Admin::ApplicationController
        include Concerns::AssemblyAdmin

        def new
          enforce_permission_to :create, :assembly
          @form = form(AssemblyCopyForm).from_model(current_assembly)
        end

        def create
          enforce_permission_to :create, :assembly
          @form = form(AssemblyCopyForm).from_params(params)

          CopyAssembly.call(@form, current_assembly) do
            on(:ok) do
              flash[:notice] = I18n.t("assemblies_copies.create.success", scope: "decidim.admin")
              redirect_to assemblies_path(parent_id: current_assembly.parent_id)
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("assemblies_copies.create.error", scope: "decidim.admin")
              render :new
            end
          end
        end
      end
    end
  end
end

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
decidim-assemblies-0.26.10 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.9 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.8 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.7 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.5 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.4 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.3 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.2 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.1 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.0 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.0.rc2 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.26.0.rc1 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.2 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.1 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.0 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.0.rc4 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.0.rc3 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.0.rc2 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.25.0.rc1 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb
decidim-assemblies-0.24.3 app/controllers/decidim/assemblies/admin/assembly_copies_controller.rb