Class: Decidim::CollaborativeTexts::DocumentsController
- Inherits:
-
ApplicationController
- Object
- Decidim::Components::BaseController
- ApplicationController
- Decidim::CollaborativeTexts::DocumentsController
- Includes:
- AjaxPermissionHandler, FormFactory, Paginable
- Defined in:
- app/controllers/decidim/collaborative_texts/documents_controller.rb
Instance Method Summary collapse
- #index ⇒ Object
- #show ⇒ Object
-
#update ⇒ Object
roll out a new version of the document (only admins).
Instance Method Details
#index ⇒ Object
12 |
# File 'app/controllers/decidim/collaborative_texts/documents_controller.rb', line 12 def index; end |
#show ⇒ Object
14 15 16 |
# File 'app/controllers/decidim/collaborative_texts/documents_controller.rb', line 14 def show raise ActionController::RoutingError, "Not Found" unless document end |
#update ⇒ Object
roll out a new version of the document (only admins)
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/collaborative_texts/documents_controller.rb', line 19 def update (:rollout, :collaborative_text, document:) @form = form(RolloutForm).from_params(params, document:) Rollout.call(@form) do on(:ok) do render json: { redirect: @form.draft? ? presenter.edit : presenter.path } end on(:invalid) do render json: { message: I18n.t("document.rollout.invalid", scope: "decidim.collaborative_texts", errors: @form.errors.) }, status: :unprocessable_content end end end |