Class: Spree::Admin::ActionText::VideoEmbedsController
- Inherits:
-
BaseController
- Object
- BaseController
- BaseController
- Spree::Admin::ActionText::VideoEmbedsController
- Defined in:
- app/controllers/spree/admin/action_text/video_embeds_controller.rb
Constant Summary
Constants included from LocaleConcern
LocaleConcern::ADMIN_LOCALE_COOKIE
Instance Method Summary collapse
Methods included from BreadcrumbConcern
#add_breadcrumb_icon_instance_var
Instance Method Details
#create ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/spree/admin/action_text/video_embeds_controller.rb', line 7 def create = (params[:url]) = ::ActionText::VideoEmbed.new(url: params[:url]) .raw_html = .html .thumbnail_url = .thumbnail_url if .save content = render_to_string( partial: 'action_text/video_embeds/thumbnail', locals: { video_embed: }, formats: [:html] ) render json: { sgid: .attachable_sgid, content: content }, status: :created else render json: { error: .errors..to_sentence }, status: :unprocessable_content end end |
#destroy ⇒ Object
27 28 29 |
# File 'app/controllers/spree/admin/action_text/video_embeds_controller.rb', line 27 def destroy ::ActionText::VideoEmbed.from_attachable_sgid(params[:id]).destroy end |