Class: Decidim::DecidimAwesome::EditorImagesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Decidim::DecidimAwesome::EditorImagesController
- Includes:
- AjaxPermissionHandler, FormFactory
- Defined in:
- app/controllers/decidim/decidim_awesome/editor_images_controller.rb
Overview
This controller handles image uploads for the Tiptap editor
Instance Method Summary collapse
Methods inherited from ApplicationController
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/decidim/decidim_awesome/editor_images_controller.rb', line 10 def create (:create, :editor_image, awesome_config:) @form = form(EditorImageForm).from_params(form_values) CreateEditorImage.call(@form) do on(:ok) do |image| url = image.attached_uploader(:file).path render json: { url:, message: I18n.t("success", scope: "decidim.editor_images.create") } end on(:invalid) do || render json: { message: I18n.t("error", scope: "decidim.editor_images.create") }, status: :unprocessable_entity end end end |