Sha256: 369fd0571d9fcc64538d1390aa7267b3753c4f9f4d095ef5bdcf48e3b673f313
Contents?: true
Size: 844 Bytes
Versions: 7
Compression:
Stored size: 844 Bytes
Contents
module Scrivito class PageConfig < Struct.new(:obj, :editing_context, :lookup_context) def initialize(options) super(*options.values_at(:obj, :editing_context, :lookup_context)) end def to_json { current_page: current_page_config, user_id: user_id_config, preloaded_obj_data: preloaded_obj_data }.to_json end private def user_id_config editor.id end def preloaded_obj_data if obj obj_in_selected_workpace = editing_context.selected_workspace.objs.find_including_deleted(obj.id) [obj_in_selected_workpace.data_from_cms.to_h] else [] end end def current_page_config return {} unless obj { id: obj.id, is_restricted: editor.restriction_messages_for(obj).any?, } end def editor editing_context.editor end end end
Version data entries
7 entries across 7 versions & 1 rubygems