Sha256: 4bc950e434c708e6fabe2118ba3ed2eed9f7232f9240ff48060cb7bb7be41121
Contents?: true
Size: 1.24 KB
Versions: 16
Compression:
Stored size: 1.24 KB
Contents
module Scrivito class UiController < ActionController::Base def index @application_src = application_src if editing_context.editor @ui_config = UiConfig.new( editing_context: editing_context, resource: resource, return_to: params[:return_to], app_extension_tags: app_extension_tags, obj_models: Scrivito.models.objs, widget_models: Scrivito.models.widgets, lookup_context: lookup_context, ).to_json render 'scrivito/ui/index.html' else redirect_to @application_src end end private def application_src return "/" if resource_details? given_query = request.env['QUERY_STRING'] query = "?#{given_query}" if given_query.present? "/#{params['application_path']}#{query}" end def resource_details? params[:resource_id].present? end def resource if resource_details? editing_context.selected_workspace.objs.find_including_deleted(params[:resource_id]) end end def app_extension_tags view_context.javascript_include_tag('scrivito_app_extensions') + view_context.stylesheet_link_tag('scrivito_app_extensions') end def editing_context EditingContextMiddleware.from_request(request) end end end
Version data entries
16 entries across 16 versions & 1 rubygems