Sha256: 8af0259c9c2e049bac0184b7f64aac5ed53bf3b4e933140c0f30c947affe5448
Contents?: true
Size: 1.83 KB
Versions: 22
Compression:
Stored size: 1.83 KB
Contents
# frozen_string_literal: true module Decidim module Conferences module Admin # Controller that allows managing registration type publications. # class RegistrationTypePublicationsController < Decidim::Conferences::Admin::ApplicationController include Concerns::ConferenceAdmin def create @registration_type = collection.find(params[:registration_type_id]) enforce_permission_to :publish, :registration_type, registration_type: @registration_type PublishRegistrationType.call(@registration_type, current_user) do on(:ok) do flash[:notice] = I18n.t("registration_type_publications.create.success", scope: "decidim.admin") end on(:invalid) do flash[:alert] = I18n.t("registration_type_publications.create.error", scope: "decidim.admin") end redirect_back(fallback_location: conference_registration_types_path(current_conference)) end end def destroy @registration_type = collection.find(params[:registration_type_id]) enforce_permission_to :unpublish, :registration_type, registration_type: @registration_type UnpublishRegistrationType.call(@registration_type, current_user) do on(:ok) do flash[:notice] = I18n.t("registration_type_publications.destroy.success", scope: "decidim.admin") end on(:invalid) do flash[:alert] = I18n.t("registration_type_publications.destroy.error", scope: "decidim.admin") end redirect_back(fallback_location: conference_registration_types_path(current_conference)) end end private def collection @collection ||= current_conference.registration_types end end end end end
Version data entries
22 entries across 22 versions & 1 rubygems