Sha256: 0ad9db8cfe1f048916d986e64c36d3d3abd932c4f35a1525aa58d6a14874952d

Contents?: true

Size: 1.42 KB

Versions: 60

Compression:

Stored size: 1.42 KB

Contents

# frozen_string_literal: true

module Decidim
  module Conferences
    module Admin
      # Controller that allows managing conference publications.
      #
      class ConferencePublicationsController < Decidim::Conferences::Admin::ApplicationController
        include Concerns::ConferenceAdmin

        def create
          enforce_permission_to :publish, :conference, conference: current_conference

          PublishConference.call(current_conference, current_user) do
            on(:ok) do
              flash[:notice] = I18n.t("conference_publications.create.success", scope: "decidim.admin")
            end

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

            redirect_back(fallback_location: conferences_path)
          end
        end

        def destroy
          enforce_permission_to :publish, :conference, conference: current_conference

          UnpublishConference.call(current_conference, current_user) do
            on(:ok) do
              flash[:notice] = I18n.t("conference_publications.destroy.success", scope: "decidim.admin")
            end

            on(:invalid) do
              flash.now[:alert] = I18n.t("conference_publications.destroy.error", scope: "decidim.admin")
            end

            redirect_back(fallback_location: conferences_path)
          end
        end
      end
    end
  end
end

Version data entries

60 entries across 60 versions & 1 rubygems

Version Path
decidim-conferences-0.27.9 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.8 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.7 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.6 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.10 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.9 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.5 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.8 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.4 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.3 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.7 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.5 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.2 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.1 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.4 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.0 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.3 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.0.rc2 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.27.0.rc1 app/controllers/decidim/conferences/admin/conference_publications_controller.rb
decidim-conferences-0.26.2 app/controllers/decidim/conferences/admin/conference_publications_controller.rb