Sha256: d54e74eb0c607b59d8912f21f3e85a373b3cc9f3614d19aeb48a207470efa081
Contents?: true
Size: 1 KB
Versions: 2
Compression:
Stored size: 1 KB
Contents
module ScrivitoEditors class MediabrowserController < ApplicationController # Return JSON responses without layout information. layout false # Renders the mediabrowser modal and returns it in a JSON response. def modal render json: { content: render_to_string } end # Render a JSON response that holds the mediabrowser inspector markup. The inspector either # renders the details view for the selected object, or a fallback view that is located under # 'app/views/obj/details'. def inspector @obj = Obj.find(params[:id]) options = { layout: 'scrivito_editors/mediabrowser/inspector', } content = begin render_to_string(details_view_template(@obj), options) rescue ActionView::MissingTemplate render_to_string('scrivito_editors/obj/details', options) end render json: { content: content } end private def details_view_template(obj) "#{obj.obj_class_name.underscore}/details" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
scrivito_editors-0.0.9 | app/controllers/scrivito_editors/mediabrowser_controller.rb |
scrivito_editors-0.0.8 | app/controllers/scrivito_editors/mediabrowser_controller.rb |