Class: Decidim::Admin::SpacePublicationsController
- Inherits:
-
Decidim::Assemblies::Admin::ApplicationController
- Object
- Decidim::Assemblies::Admin::ApplicationController
- Decidim::Admin::SpacePublicationsController
- Defined in:
- app/controllers/decidim/admin/space_publications_controller.rb
Overview
Base controller that can be inherited by other spaces to publish and unpublish the Space
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/decidim/admin/space_publications_controller.rb', line 8 def create publish_command.call(current_assembly, current_user) do on(:ok) do flash[:notice] = I18n.t("create.success", scope: i18n_scope) end on(:invalid) do flash.now[:alert] = I18n.t("create.error", scope: i18n_scope) end redirect_back(fallback_location: assemblies_path) end end |
#destroy ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/controllers/decidim/admin/space_publications_controller.rb', line 24 def destroy unpublish_command.call(current_assembly, current_user) do on(:ok) do flash[:notice] = I18n.t("destroy.success", scope: i18n_scope) end on(:invalid) do flash.now[:alert] = I18n.t("destroy.error", scope: i18n_scope) end redirect_back(fallback_location: assemblies_path) end end |