infopark_fiona7 0.30.0.2 → 0.70.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascripts/fiona7.js +1 -282
- data/app/assets/javascripts/fiona7_ui.js +335 -0
- data/app/assets/stylesheets/fiona7.css.scss +4 -36
- data/app/assets/stylesheets/fiona7_ui.css.scss +39 -0
- data/app/controllers/fiona7/blobs_controller.rb +13 -23
- data/app/controllers/fiona7/release_controller.rb +1 -0
- data/app/controllers/fiona7/sessions_controller.rb +3 -5
- data/app/helpers/fiona7_override_helper.rb +6 -2
- data/app/models/fiona7/edited_obj.rb +6 -1
- data/app/models/fiona7/released_obj.rb +11 -3
- data/app/models/fiona7/write_obj.rb +18 -3
- data/app/models/fiona7_login_page.rb +3 -0
- data/app/views/scrivito/ui/index.html.erb +16 -0
- data/config/routes.rb +2 -0
- data/infopark_fiona7.gemspec +6 -4
- data/lib/fiona7/builder/batch_widget_writer.rb +7 -3
- data/lib/fiona7/builder/obj_builder.rb +130 -42
- data/lib/fiona7/builder/obj_class_builder.rb +3 -59
- data/lib/fiona7/builder/obj_class_updater.rb +7 -44
- data/lib/fiona7/builder/obj_updater.rb +25 -7
- data/lib/fiona7/builder/widget_builder.rb +24 -0
- data/lib/fiona7/builder/widget_building.rb +2 -7
- data/lib/fiona7/builder/widget_updater.rb +21 -0
- data/lib/fiona7/controllers/content_service/obj_controller.rb +16 -25
- data/lib/fiona7/controllers/rest_api/blob_controller.rb +41 -2
- data/lib/fiona7/controllers/rest_api/obj_controller.rb +19 -7
- data/lib/fiona7/controllers/rest_api/workspace_controller.rb +1 -1
- data/lib/fiona7/engine.rb +58 -7
- data/lib/fiona7/fiona_connector_patches/basic_obj.rb +46 -0
- data/lib/fiona7/initializer.rb +15 -11
- data/lib/fiona7/json/obj_decorator.rb +53 -31
- data/lib/fiona7/json/reverse_obj_decorator.rb +36 -0
- data/lib/fiona7/json/widget_decorator.rb +3 -1
- data/lib/fiona7/link_converter/fiona_to_scrivito.rb +45 -13
- data/lib/fiona7/link_converter/scrivito_to_fiona.rb +1 -1
- data/lib/fiona7/middleware/server_detection_middleware.rb +27 -0
- data/lib/fiona7/middleware/table_switching_middleware.rb +33 -0
- data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb +5 -11
- data/lib/fiona7/mode_switch/composite.rb +2 -4
- data/lib/fiona7/naive_search_engine.rb +66 -16
- data/lib/fiona7/routers/rest_api.rb +50 -45
- data/lib/fiona7/routing_monkey_patch.rb +5 -3
- data/lib/fiona7/scrivito_patches/attribute_content.rb +9 -10
- data/lib/fiona7/scrivito_patches/attribute_serializer.rb +15 -0
- data/lib/fiona7/scrivito_patches/basic_obj.rb +25 -19
- data/lib/fiona7/scrivito_patches/basic_widget.rb +4 -0
- data/lib/fiona7/scrivito_patches/binary.rb +452 -33
- data/lib/fiona7/scrivito_patches/client_config.rb +0 -19
- data/lib/fiona7/scrivito_patches/cms_backend.rb +48 -0
- data/lib/fiona7/scrivito_patches/cms_field_tag.rb +19 -0
- data/lib/fiona7/scrivito_patches/cms_rest_api.rb +20 -3
- data/lib/fiona7/scrivito_patches/cms_routing.rb +20 -34
- data/lib/fiona7/scrivito_patches/controller_actions.rb +0 -8
- data/lib/fiona7/scrivito_patches/migrator.rb +4 -0
- data/lib/fiona7/scrivito_patches/objs_controller.rb +18 -0
- data/lib/fiona7/scrivito_patches/type_computer.rb +12 -12
- data/lib/fiona7/scrivito_patches/webservice_controller.rb +21 -0
- data/lib/fiona7/scrivito_patches/workspace.rb +8 -5
- data/lib/fiona7/shadow_classes.rb +74 -0
- data/lib/fiona7/table_switcher.rb +39 -0
- data/lib/fiona7/type_loader.rb +63 -0
- data/lib/fiona7/type_register.rb +170 -89
- data/lib/fiona7/type_synchronizer.rb +68 -0
- data/lib/fiona7/version.rb +1 -1
- data/lib/fiona7/version_helper.rb +35 -54
- data/lib/fiona7/widget_resolver.rb +1 -1
- data/lib/tasks/fiona7_tasks.rake +0 -8
- metadata +57 -18
- data/lib/fiona7/controllers/rest_api/obj_class_controller.rb +0 -39
- data/lib/fiona7/json/obj_class_decorator.rb +0 -45
- data/lib/fiona7/mode_switch/constants.rb +0 -86
- data/lib/fiona7/type_register_mixin.rb +0 -9
data/lib/fiona7/engine.rb
CHANGED
@@ -15,29 +15,56 @@ require "infopark_reactor"
|
|
15
15
|
|
16
16
|
require "fiona7/mode_switch"
|
17
17
|
require "fiona7/scrivito_patches/attribute_content"
|
18
|
+
require "fiona7/scrivito_patches/attribute_serializer"
|
18
19
|
require "fiona7/scrivito_patches/basic_obj"
|
19
20
|
require "fiona7/scrivito_patches/basic_widget"
|
20
21
|
require "fiona7/scrivito_patches/binary"
|
21
|
-
require "fiona7/scrivito_patches/
|
22
|
+
require "fiona7/scrivito_patches/cms_backend"
|
23
|
+
require "fiona7/scrivito_patches/cms_field_tag"
|
22
24
|
require "fiona7/scrivito_patches/controller_actions"
|
23
|
-
|
25
|
+
# different load order !!
|
26
|
+
#require "fiona7/scrivito_patches/cms_dispatch_controller"
|
24
27
|
require "fiona7/scrivito_patches/cms_rest_api"
|
25
28
|
require "fiona7/scrivito_patches/cms_routing"
|
26
29
|
require "fiona7/scrivito_patches/link_parser"
|
27
|
-
require "fiona7/scrivito_patches/obj_class"
|
28
30
|
require "fiona7/scrivito_patches/migrator"
|
29
31
|
require "fiona7/scrivito_patches/type_computer"
|
30
32
|
require "fiona7/scrivito_patches/workspace"
|
31
33
|
|
34
|
+
require "fiona7/middleware/table_switching_middleware"
|
35
|
+
require "fiona7/middleware/server_detection_middleware"
|
36
|
+
|
37
|
+
module Scrivito
|
38
|
+
class LogSubscriber < ActiveSupport::LogSubscriber
|
39
|
+
def backend_request(event)
|
40
|
+
self.class.runtime += event.duration
|
41
|
+
return unless logger.debug?
|
42
|
+
|
43
|
+
duration = '(%.1fms)' % [event.duration]
|
44
|
+
|
45
|
+
param = event.payload[:params]
|
46
|
+
param_text = " #{param}" if param
|
47
|
+
|
48
|
+
verb_text = event.payload[:verb].upcase
|
49
|
+
path_text = event.payload[:path]
|
50
|
+
|
51
|
+
debug " Fiona7 #{verb_text} #{path_text}#{param_text} #{duration}"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
32
56
|
|
33
57
|
require "fiona7/routers/content_service"
|
34
58
|
require "fiona7/routers/rest_api"
|
35
59
|
|
36
60
|
require 'fiona7/scrivito_user'
|
37
61
|
|
62
|
+
require 'fiona7/type_synchronizer'
|
63
|
+
|
38
64
|
module Fiona7
|
39
65
|
mattr_accessor :mode
|
40
66
|
mattr_accessor :login
|
67
|
+
mattr_accessor :root
|
41
68
|
|
42
69
|
class Config < Struct.new("Config", :mode, :instance, :host, :port, :username, :secret, :root_mode)
|
43
70
|
end
|
@@ -54,6 +81,8 @@ module Fiona7
|
|
54
81
|
secret: config.secret
|
55
82
|
}
|
56
83
|
|
84
|
+
Fiona7.root = config.username
|
85
|
+
|
57
86
|
Fiona7.mode = config.mode
|
58
87
|
if Fiona7.login = !config.root_mode
|
59
88
|
Scrivito.configure do |config|
|
@@ -84,6 +113,13 @@ module Fiona7
|
|
84
113
|
|
85
114
|
class Engine < ::Rails::Engine
|
86
115
|
|
116
|
+
config.to_prepare do
|
117
|
+
# TODO: do some smart optimizations
|
118
|
+
require "fiona7/initializer"
|
119
|
+
initializer = Fiona7::Initializer.new
|
120
|
+
initializer.initialize_system
|
121
|
+
end
|
122
|
+
|
87
123
|
initializer "fiona7.mode_switch" do |app|
|
88
124
|
mode = nil
|
89
125
|
|
@@ -95,6 +131,10 @@ module Fiona7
|
|
95
131
|
raise "Invalid mode: #{Fiona7.mode}. Valid modes are :legacy and :standalone. Please refer to the documentation for more information"
|
96
132
|
end
|
97
133
|
|
134
|
+
# delayed init, patching sooner breaks AR
|
135
|
+
# later and it breaks Obj
|
136
|
+
require "fiona7/fiona_connector_patches/basic_obj"
|
137
|
+
|
98
138
|
ModeSwitch::Composite.new(app).public_send(mode)
|
99
139
|
end
|
100
140
|
|
@@ -115,24 +155,35 @@ module Fiona7
|
|
115
155
|
end
|
116
156
|
|
117
157
|
initializer "fiona7.authorize_reactor" do |app|
|
158
|
+
|
118
159
|
ActionController::Base.__send__(:define_method, :rsession_auth) do
|
119
160
|
if !Fiona7.login
|
120
|
-
rsession.user_name =
|
161
|
+
rsession.user_name = Fiona7.root unless rsession.user_name == Fiona7.root
|
121
162
|
end
|
122
163
|
end
|
123
164
|
end
|
124
165
|
|
125
166
|
initializer "fiona7.patch_assets" do |app|
|
126
|
-
app.config.assets.precompile += %w(fiona7.css fiona7.js fiona7-login.css)
|
167
|
+
app.config.assets.precompile += %w(fiona7_ui.css fiona7_ui.js fiona7.css fiona7.js fiona7-login.css)
|
127
168
|
end
|
128
169
|
|
129
170
|
initializer "fiona7.runtime_patches" do |app|
|
130
|
-
|
131
|
-
require "fiona7/
|
171
|
+
require "fiona7/scrivito_patches/cms_dispatch_controller"
|
172
|
+
require "fiona7/scrivito_patches/webservice_controller"
|
173
|
+
require "fiona7/scrivito_patches/objs_controller"
|
132
174
|
end
|
133
175
|
|
176
|
+
initializer "fiona7.preload_cms_type_defs" do |app|
|
177
|
+
type_register = Fiona7::TypeRegister.instance
|
178
|
+
RailsConnector::Meta::EagerLoader.instance.obj_classes.each do |_, obj_class|
|
179
|
+
type_register.read_mangled(obj_class.name)
|
180
|
+
end
|
181
|
+
|
182
|
+
end
|
134
183
|
# This ensures that reactor is loaded in the app
|
135
184
|
config.after_initialize { Fiona7::WriteObj }
|
136
185
|
|
186
|
+
config.app_middleware.use "Fiona7::Middleware::TableSwitchingMiddleware"
|
187
|
+
config.app_middleware.use "Fiona7::Middleware::ServerDetectionMiddleware"
|
137
188
|
end
|
138
189
|
end
|
@@ -1,9 +1,55 @@
|
|
1
1
|
require 'rails_connector/basic_obj'
|
2
|
+
require 'fiona7/shadow_classes'
|
2
3
|
|
3
4
|
module RailsConnector
|
4
5
|
class BasicObj
|
5
6
|
def scrivito_obj
|
6
7
|
Scrivito::Obj.find(self.id)
|
7
8
|
end
|
9
|
+
|
10
|
+
# never use cached permissions
|
11
|
+
def permissions
|
12
|
+
arel_permissions
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.in_place(type='Obj',&block)
|
16
|
+
klass = ShadowClasses.fetch(self.name,type)
|
17
|
+
klass.class_eval(&block)
|
18
|
+
klass
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.widget_class
|
22
|
+
self.shadow_class
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.model_class
|
26
|
+
self.shadow_class
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.shadow_class
|
30
|
+
ShadowClasses.const_get(self.name, false)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
class << self
|
35
|
+
|
36
|
+
def inherited(subclass,*args)
|
37
|
+
super
|
38
|
+
if subclass.name == 'Obj' && !::Scrivito.const_defined?('Obj', false)
|
39
|
+
::Scrivito.const_set('Obj', Class.new(::Scrivito::BasicObj))
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
module Reactor
|
48
|
+
module Persistence
|
49
|
+
module ClassMethods
|
50
|
+
def sanitize_name(old_name)
|
51
|
+
old_name
|
52
|
+
end
|
53
|
+
end
|
8
54
|
end
|
9
55
|
end
|
data/lib/fiona7/initializer.rb
CHANGED
@@ -10,6 +10,15 @@ module Fiona7
|
|
10
10
|
'X_widget_pool' => 'linklist'
|
11
11
|
}
|
12
12
|
|
13
|
+
def initialize_system
|
14
|
+
should_run = self.sanity_check
|
15
|
+
return unless should_run
|
16
|
+
|
17
|
+
self.classes_and_attributes
|
18
|
+
self.set_valid_sub_obj_classes
|
19
|
+
self.create_login_page
|
20
|
+
end
|
21
|
+
|
13
22
|
def sanity_check
|
14
23
|
any_class_present = false
|
15
24
|
classes_present = CLASSES_MAP.all? do |name, type|
|
@@ -17,7 +26,8 @@ module Fiona7
|
|
17
26
|
any_class_present ||= obj_class && obj_class.obj_type == type
|
18
27
|
end
|
19
28
|
|
20
|
-
|
29
|
+
return false if classes_present
|
30
|
+
|
21
31
|
any_class_present && raise("Misconfiguration of obj classes detected")
|
22
32
|
|
23
33
|
any_attribute_present = false
|
@@ -27,6 +37,8 @@ module Fiona7
|
|
27
37
|
end
|
28
38
|
|
29
39
|
any_class_present && raise("Misconfiguration of attributes detected")
|
40
|
+
|
41
|
+
return true
|
30
42
|
end
|
31
43
|
|
32
44
|
def classes_and_attributes
|
@@ -54,17 +66,9 @@ module Fiona7
|
|
54
66
|
end
|
55
67
|
|
56
68
|
def create_login_page
|
69
|
+
# TODO: write new creation procedure
|
57
70
|
Scrivito::Workspace.current = Scrivito::Workspace.find('rtc')
|
58
|
-
Scrivito::
|
59
|
-
name: 'Fiona7LoginPage',
|
60
|
-
title: 'Login Page',
|
61
|
-
attributes: [
|
62
|
-
{name: "title", type: "string"},
|
63
|
-
{name: "body", type: "html"}
|
64
|
-
]
|
65
|
-
)
|
66
|
-
Scrivito::Obj.create(_obj_class: 'Fiona7LoginPage', _path: '/_global/login_page', title: 'Log in')
|
67
|
-
Scrivito::ObjClass.find('Fiona7LoginPage').update(is_active: false)
|
71
|
+
Scrivito::BasicObj.create(_obj_class: 'Fiona7LoginPage', _path: '/_global/login_page', title: 'Log in')
|
68
72
|
end
|
69
73
|
|
70
74
|
protected
|
@@ -6,7 +6,6 @@ module Fiona7
|
|
6
6
|
end
|
7
7
|
|
8
8
|
require 'fiona7/assert'
|
9
|
-
require 'fiona7/type_register_mixin'
|
10
9
|
require 'fiona7/link_converter/fiona_to_scrivito'
|
11
10
|
require 'fiona7/json/widget_decorator'
|
12
11
|
require 'fiona7/widget_resolver'
|
@@ -14,8 +13,6 @@ require 'fiona7/widget_resolver'
|
|
14
13
|
module Fiona7
|
15
14
|
module JSON
|
16
15
|
class ObjDecorator
|
17
|
-
include TypeRegisterMixin
|
18
|
-
|
19
16
|
def initialize(klass, obj)
|
20
17
|
@klass = klass
|
21
18
|
@obj = obj
|
@@ -34,43 +31,59 @@ module Fiona7
|
|
34
31
|
protected
|
35
32
|
def standard_attrs
|
36
33
|
attrs = {
|
37
|
-
_id: [@obj.id],
|
38
|
-
|
39
|
-
_obj_class: [@obj.obj_class],
|
34
|
+
_id: [@obj.id.to_s],
|
35
|
+
_obj_class: [@obj.obj_class.gsub("__", "::")],
|
40
36
|
_last_changed: [@obj.last_changed.try(:to_iso)],
|
41
37
|
_widget_pool: [{}]
|
42
38
|
}
|
39
|
+
if !@obj.edited? && !@obj.released?
|
40
|
+
attrs[:_modification] = "new"
|
41
|
+
elsif @obj.edited? && !@obj.released?
|
42
|
+
attrs[:_modification] = "new"
|
43
|
+
elsif @obj.edited? && @obj.released?
|
44
|
+
attrs[:_modification] = "edited"
|
45
|
+
end
|
46
|
+
|
47
|
+
attrs[:_path] = [@obj.path] unless @obj.path =~ /^\/_orphaned/
|
43
48
|
attrs[:_permalink] = [@obj.permalink] if @obj.permalink.present?
|
44
49
|
attrs
|
45
50
|
end
|
46
51
|
|
47
52
|
def add_custom_attributes(attrs, *args)
|
48
|
-
|
49
|
-
|
53
|
+
type_definition = Fiona7::TypeRegister.instance.read_mangled(@obj.obj_class)
|
54
|
+
type_definition.attrs.each do |attribute|
|
55
|
+
virtual_attribute_name = attribute.name
|
50
56
|
real_attribute_name = attribute.real_name
|
51
|
-
virtual_attribute_type = attribute.
|
57
|
+
virtual_attribute_type = attribute.type.to_sym
|
52
58
|
|
53
59
|
val = case virtual_attribute_type
|
54
60
|
when :link
|
55
|
-
deserialize_link(@obj[real_attribute_name].try(:first))
|
61
|
+
deserialize_link(@obj.attr_values[real_attribute_name].try(:first))
|
56
62
|
when :linklist
|
57
|
-
(@obj[real_attribute_name] || []).map {|link| deserialize_link(link) }
|
63
|
+
(@obj.attr_values[real_attribute_name] || []).map {|link| deserialize_link(link) }
|
58
64
|
when :multienum
|
59
65
|
@obj[real_attribute_name] || []
|
60
66
|
when :reference
|
61
|
-
deserialize_reference(@obj[real_attribute_name].try(:first))
|
67
|
+
deserialize_reference(@obj.attr_values[real_attribute_name].try(:first))
|
62
68
|
when :referencelist
|
63
|
-
(@obj[real_attribute_name] || []).map {|link| deserialize_reference(link) }.compact
|
69
|
+
(@obj.attr_values[real_attribute_name] || []).map {|link| deserialize_reference(link) }.compact
|
64
70
|
when :date
|
65
71
|
@obj[real_attribute_name].try(:to_iso)
|
66
|
-
when :
|
67
|
-
deserialize_widget_field(@obj[real_attribute_name] || [])
|
72
|
+
when :widgetlist
|
73
|
+
deserialize_widget_field(@obj.attr_values[real_attribute_name] || [])
|
68
74
|
when :html
|
69
75
|
deserialize_html(@obj[real_attribute_name])
|
70
76
|
when :binary
|
71
|
-
|
77
|
+
if !Fiona7.mode == :legacy || !@obj.binary?
|
78
|
+
deserialize_binary(@obj.attr_values[real_attribute_name].try(:first))
|
79
|
+
else
|
80
|
+
{id: "%032d" % @obj.id.to_s}
|
81
|
+
end
|
72
82
|
when :enum, :multienum, :text, :string
|
73
83
|
@obj[real_attribute_name]
|
84
|
+
when :stringlist
|
85
|
+
# TODO: get rid of this rescue nil
|
86
|
+
::JSON.parse(@obj[real_attribute_name]) rescue nil
|
74
87
|
else
|
75
88
|
Assert.success(
|
76
89
|
false,
|
@@ -84,35 +97,44 @@ module Fiona7
|
|
84
97
|
|
85
98
|
def deserialize_link(link)
|
86
99
|
if link
|
87
|
-
{
|
100
|
+
deserialized = {
|
88
101
|
# remove possible external prefix for protcol-less urls
|
89
|
-
url: link
|
90
|
-
title: link
|
91
|
-
target: link
|
102
|
+
url: link["url"].try(:gsub, /\Aexternal:/, ''),
|
103
|
+
title: link["title"],
|
104
|
+
target: link["target"],
|
92
105
|
# content service uses destination
|
93
|
-
destination: link.
|
106
|
+
destination: link["destination"].to_s,
|
94
107
|
# rest api uses obj_id
|
95
|
-
obj_id: link.
|
96
|
-
query: link
|
97
|
-
fragment: link
|
108
|
+
obj_id: link["destination"].to_s,
|
109
|
+
query: link["search"],
|
110
|
+
fragment: link["fragment"]
|
98
111
|
}
|
112
|
+
|
113
|
+
# TODO: refactor this code
|
114
|
+
if deserialized[:url].present?
|
115
|
+
deserialized.delete(:destination)
|
116
|
+
deserialized.delete(:obj_id)
|
117
|
+
end
|
118
|
+
|
119
|
+
deserialized
|
99
120
|
end
|
100
121
|
end
|
101
122
|
|
102
123
|
def deserialize_reference(link)
|
103
|
-
if link && link
|
104
|
-
link.
|
124
|
+
if link && link["type"] == "internal"
|
125
|
+
link["destination"].to_s
|
105
126
|
end
|
106
127
|
end
|
107
128
|
|
108
129
|
def deserialize_widget_field(linklist)
|
109
130
|
if !linklist.empty?
|
131
|
+
widget_ids = []
|
110
132
|
widgets = linklist.map do |link|
|
111
|
-
widget_id = link
|
112
|
-
|
133
|
+
widget_id = link["title"]
|
134
|
+
widget_ids << widget_id
|
113
135
|
end
|
114
136
|
|
115
|
-
|
137
|
+
widget_ids
|
116
138
|
end
|
117
139
|
end
|
118
140
|
|
@@ -122,7 +144,7 @@ module Fiona7
|
|
122
144
|
|
123
145
|
def deserialize_binary(link)
|
124
146
|
if link
|
125
|
-
binary_id = link
|
147
|
+
binary_id = link["title"]
|
126
148
|
if binary_id.length == 32 && binary_id =~ /0{16,}0*[0-9]+/
|
127
149
|
{id: binary_id}
|
128
150
|
end
|
@@ -130,7 +152,7 @@ module Fiona7
|
|
130
152
|
end
|
131
153
|
|
132
154
|
def replace_widget_pool(attrs, *args)
|
133
|
-
if (widget_links = @obj[
|
155
|
+
if (widget_links = @obj.attr_values["X_widget_pool"])
|
134
156
|
|
135
157
|
resolver = WidgetResolver.new(widget_links, @klass)
|
136
158
|
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Fiona7
|
2
|
+
module JSON
|
3
|
+
class ReverseObjDecorator < ObjDecorator
|
4
|
+
def as_json(*args)
|
5
|
+
with_types = super()
|
6
|
+
reverse_types = {}
|
7
|
+
|
8
|
+
with_types.each do |attr, (value, type)|
|
9
|
+
if type.nil?
|
10
|
+
reverse_types[attr] = value
|
11
|
+
else
|
12
|
+
reverse_types[attr] = [type, value]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
if reverse_types[:_widget_pool] && !reverse_types[:_widget_pool].empty?
|
17
|
+
widgets_reverse_types = reverse_types[:_widget_pool].map do |id, values|
|
18
|
+
reversed_values = {}
|
19
|
+
values.each do |attr, (value, type)|
|
20
|
+
if type.nil?
|
21
|
+
reversed_values[attr] = value
|
22
|
+
else
|
23
|
+
reversed_values[attr] = [type, value]
|
24
|
+
end
|
25
|
+
end
|
26
|
+
[id, reversed_values]
|
27
|
+
end
|
28
|
+
|
29
|
+
reverse_types[:_widget_pool] = Hash[widgets_reverse_types]
|
30
|
+
end
|
31
|
+
|
32
|
+
reverse_types.as_json(*args)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|