Class: Decidim::EditorImagesController
- Inherits:
-
ApplicationController
- Object
- DecidimController
- ApplicationController
- Decidim::EditorImagesController
- Includes:
- FormFactory
- Defined in:
- app/controllers/decidim/editor_images_controller.rb
Instance Method Summary collapse
Methods included from UserBlockedChecker
#check_user_block_status, #check_user_not_blocked
Methods included from NeedsSnippets
Methods included from Headers::HttpCachingDisabler
Methods included from HasStoredPath
#skip_store_location?, #store_current_location
Methods included from TranslatableAttributes
Methods included from RegistersPermissions
Methods included from NeedsOrganization
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'app/controllers/decidim/editor_images_controller.rb', line 10 def create :create, :editor_image @form = form(EditorImageForm).from_params(form_values) CreateEditorImage.call(@form) do on(:ok) do |image| render json: { url: image.attached_uploader(:file).path, 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 |