Sha256: ecf5f3b6eda2bc335d748e2ffba4326219afad715e13b13b7182773edb974e2c

Contents?: true

Size: 898 Bytes

Versions: 35

Compression:

Stored size: 898 Bytes

Contents

module ScrivitoContentBrowser
  class ContentBrowserController < ApplicationController
    # Return JSON responses without layout information.
    layout false

    # Render a JSON response that holds the content browser 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_content_browser/inspector',
      }

      content = begin
        render_to_string(details_view_template(@obj), options)
      rescue ActionView::MissingTemplate
        render_to_string('scrivito_content_browser/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

35 entries across 35 versions & 1 rubygems

Version Path
scrivito_content_browser-0.70.2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.70.1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.70.0 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.70.0.rc3 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.70.0.rc2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.70.0.rc1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.66.0 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.66.0.rc2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.65.2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.66.0.rc1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.65.1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.65.0 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.65.0.rc2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.65.0.rc1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.60.0 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.60.0.rc2 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.50.1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.60.0.rc1 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.50.0 app/controllers/scrivito_content_browser/content_browser_controller.rb
scrivito_content_browser-0.50.0.rc2 app/controllers/scrivito_content_browser/content_browser_controller.rb