lib/scrivito/ui_config.rb in scrivito_sdk-1.1.1 vs lib/scrivito/ui_config.rb in scrivito_sdk-1.2.0.rc1
- old
+ new
@@ -1,21 +1,24 @@
module Scrivito
-class UiConfig < Struct.new(:editing_context, :resource, :return_to, :app_extension_tags)
+class UiConfig < Struct.new(:editing_context, :resource, :return_to, :app_extension_tags,
+ :obj_models, :widget_models)
def initialize(**named_params)
named_params.each { |key, value| self[key] = value }
end
def to_json
{
+ app_extension_tags: app_extension_tags,
editing_context: editing_context_config,
i18n: i18n_config,
is_development_mode: Rails.env.development?,
resource_dialog: resource_dialog_config,
user: user_config,
user_permissions: user_permissions_config,
- app_extension_tags: app_extension_tags,
+ obj_class: obj_class_config,
+ widget_class: widget_class_config,
}.to_json
end
private
@@ -42,9 +45,17 @@
}
end
def i18n_config
{locale: Scrivito::Configuration.ui_locale || I18n.locale}
+ end
+
+ def obj_class_config
+ obj_models.map(&:as_json)
+ end
+
+ def widget_class_config
+ widget_models.map(&:as_json)
end
def resource_dialog_config
return {} unless resource
{