infopark_fiona7 1.2.0.0.1 → 1.2.0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/scrivito_patches/models/obj.js +2 -6
  3. data/infopark_fiona7.gemspec +1 -1
  4. data/lib/fiona7/attribute_readers/attribute_reader.rb +17 -0
  5. data/lib/fiona7/attribute_readers/binary_as_binary.rb +12 -0
  6. data/lib/fiona7/attribute_readers/binary_as_linklist.rb +26 -0
  7. data/lib/fiona7/attribute_readers/date_as_date.rb +18 -0
  8. data/lib/fiona7/attribute_readers/factory.rb +91 -0
  9. data/lib/fiona7/attribute_readers/helpers/html_deserializer.rb +21 -0
  10. data/lib/fiona7/attribute_readers/helpers/json_deserializer.rb +11 -0
  11. data/lib/fiona7/attribute_readers/helpers/link_deserializer.rb +32 -0
  12. data/lib/fiona7/attribute_readers/html_as_html.rb +14 -0
  13. data/lib/fiona7/attribute_readers/link_as_linklist.rb +13 -0
  14. data/lib/fiona7/attribute_readers/linklist_as_linklist.rb +15 -0
  15. data/lib/fiona7/attribute_readers/multienum_as_multienum.rb +12 -0
  16. data/lib/fiona7/attribute_readers/multienum_as_text.rb +14 -0
  17. data/lib/fiona7/attribute_readers/number_as_string.rb +11 -0
  18. data/lib/fiona7/attribute_readers/reference_as_linklist.rb +14 -0
  19. data/lib/fiona7/attribute_readers/reference_as_string.rb +11 -0
  20. data/lib/fiona7/attribute_readers/referencelist_as_linklist.rb +16 -0
  21. data/lib/fiona7/attribute_readers/referencelist_as_text.rb +14 -0
  22. data/lib/fiona7/attribute_readers/simple.rb +18 -0
  23. data/lib/fiona7/attribute_readers/stringlist_as_text.rb +18 -0
  24. data/lib/fiona7/attribute_readers/widgetlist_as_linklist.rb +33 -0
  25. data/lib/fiona7/attribute_type_mapper.rb +76 -0
  26. data/lib/fiona7/attribute_writers/attribute_writer.rb +16 -0
  27. data/lib/fiona7/attribute_writers/binary_as_binary.rb +74 -0
  28. data/lib/fiona7/attribute_writers/binary_as_linklist.rb +86 -0
  29. data/lib/fiona7/attribute_writers/date_as_date.rb +11 -0
  30. data/lib/fiona7/attribute_writers/factory.rb +90 -0
  31. data/lib/fiona7/attribute_writers/helpers/html_serializer.rb +21 -0
  32. data/lib/fiona7/attribute_writers/helpers/json_serializer.rb +11 -0
  33. data/lib/fiona7/attribute_writers/helpers/link_serializer.rb +37 -0
  34. data/lib/fiona7/attribute_writers/html_as_html.rb +12 -0
  35. data/lib/fiona7/attribute_writers/link_as_linklist.rb +18 -0
  36. data/lib/fiona7/attribute_writers/linklist_as_linklist.rb +16 -0
  37. data/lib/fiona7/attribute_writers/multienum_as_multienum.rb +11 -0
  38. data/lib/fiona7/attribute_writers/multienum_as_text.rb +12 -0
  39. data/lib/fiona7/attribute_writers/number_as_string.rb +11 -0
  40. data/lib/fiona7/attribute_writers/reference_as_linklist.rb +17 -0
  41. data/lib/fiona7/attribute_writers/reference_as_string.rb +11 -0
  42. data/lib/fiona7/attribute_writers/referencelist_as_linklist.rb +19 -0
  43. data/lib/fiona7/attribute_writers/referencelist_as_text.rb +13 -0
  44. data/lib/fiona7/attribute_writers/simple.rb +11 -0
  45. data/lib/fiona7/attribute_writers/stringlist_as_text.rb +16 -0
  46. data/lib/fiona7/attribute_writers/widgetlist_as_linklist.rb +33 -0
  47. data/lib/fiona7/builder/obj_builder.rb +12 -201
  48. data/lib/fiona7/controllers/rest_api/obj_controller.rb +23 -5
  49. data/lib/fiona7/engine.rb +39 -0
  50. data/lib/fiona7/json/obj_decorator.rb +29 -121
  51. data/lib/fiona7/prefetch/obj_prefetch.rb +42 -0
  52. data/lib/fiona7/prefetch/widget_resolver_prefetch.rb +36 -0
  53. data/lib/fiona7/scrivito_patches/date_attribute.rb +16 -0
  54. data/lib/fiona7/tools/attribute_remover.rb +70 -0
  55. data/lib/fiona7/type_register.rb +9 -1
  56. data/lib/fiona7/version.rb +1 -1
  57. data/lib/fiona7/widget_resolver.rb +6 -6
  58. metadata +51 -4
@@ -5,6 +5,7 @@ require 'fiona7/type_synchronizer'
5
5
  require "fiona7/obj_class_name_mangler"
6
6
  require "fiona7/obj_class_name_demangler"
7
7
  require "fiona7/attribute_name_mangler"
8
+ require 'fiona7/attribute_type_mapper'
8
9
 
9
10
 
10
11
  module Fiona7
@@ -68,7 +69,7 @@ module Fiona7
68
69
  end
69
70
 
70
71
  def add_attr(name, type, real_name=nil, real_type=nil, values=nil)
71
- real_type ||= TYPE_MAP[type.to_sym] || type
72
+ real_type ||= Fiona7::AttributeTypeMapper.new(self.name.to_s).call(name.to_sym, type.to_sym)
72
73
  real_name = Fiona7::AttributeNameMangler.new(name, self.name).mangle
73
74
  self.attrs << Attribute.new(name.to_s, type.to_sym, real_name.to_s, real_type.to_sym, values)
74
75
  end
@@ -80,6 +81,13 @@ module Fiona7
80
81
  end
81
82
  end
82
83
 
84
+ def remove_attribute(name)
85
+ name = name.to_s
86
+ self.attrs.delete_if do |attr|
87
+ attr.name == name
88
+ end
89
+ end
90
+
83
91
  # TODO: conflict handling for type errors
84
92
  def merge(other_definition)
85
93
  other_definition.attrs.each do |other_attr|
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "1.2.0.0.1"
2
+ VERSION = "1.2.0.1.1"
3
3
  end
@@ -1,16 +1,16 @@
1
1
  module Fiona7
2
2
  class WidgetResolver
3
- def initialize(widget_pool_value, klass=WriteObj)
4
- self.value = widget_pool_value
5
- self.klass = klass
3
+ def initialize(widget_pool_value, obj_repository)
4
+ self.value = widget_pool_value
5
+ self.obj_repository = obj_repository
6
6
 
7
- preload
7
+ self.preload
8
8
  end
9
9
 
10
10
  attr_reader :id_map, :path_map, :instance_map
11
11
 
12
12
  protected
13
- attr_accessor :value, :klass
13
+ attr_accessor :value, :obj_repository
14
14
  attr_writer :id_map, :path_map, :instance_map
15
15
 
16
16
  def preload
@@ -18,7 +18,7 @@ module Fiona7
18
18
  self.value.map {|link| [link["title"], link["destination"]] }
19
19
  ]
20
20
  object_id_to_widget_instance_map = Hash[
21
- self.klass.where(obj_id: widget_id_to_object_id_map.values).map {|obj| [obj.id, obj] }
21
+ self.obj_repository.find_many(widget_id_to_object_id_map.values).compact.map {|obj| [obj.id, obj] }
22
22
  ]
23
23
 
24
24
  self.id_map = widget_id_to_object_id_map.dup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infopark_fiona7
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0.0.1
4
+ version: 1.2.0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomasz Przedmojski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-23 00:00:00.000000000 Z
11
+ date: 2016-08-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - ">="
88
88
  - !ruby/object:Gem::Version
89
- version: 1.22.3
89
+ version: 1.22.4
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
- version: 1.22.3
96
+ version: 1.22.4
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mini_magick
99
99
  requirement: !ruby/object:Gem::Requirement
@@ -161,6 +161,49 @@ files:
161
161
  - lib/fiona7/attribute_name_mangler.rb
162
162
  - lib/fiona7/attribute_names_from_cms.rb
163
163
  - lib/fiona7/attribute_names_from_queries.rb
164
+ - lib/fiona7/attribute_readers/attribute_reader.rb
165
+ - lib/fiona7/attribute_readers/binary_as_binary.rb
166
+ - lib/fiona7/attribute_readers/binary_as_linklist.rb
167
+ - lib/fiona7/attribute_readers/date_as_date.rb
168
+ - lib/fiona7/attribute_readers/factory.rb
169
+ - lib/fiona7/attribute_readers/helpers/html_deserializer.rb
170
+ - lib/fiona7/attribute_readers/helpers/json_deserializer.rb
171
+ - lib/fiona7/attribute_readers/helpers/link_deserializer.rb
172
+ - lib/fiona7/attribute_readers/html_as_html.rb
173
+ - lib/fiona7/attribute_readers/link_as_linklist.rb
174
+ - lib/fiona7/attribute_readers/linklist_as_linklist.rb
175
+ - lib/fiona7/attribute_readers/multienum_as_multienum.rb
176
+ - lib/fiona7/attribute_readers/multienum_as_text.rb
177
+ - lib/fiona7/attribute_readers/number_as_string.rb
178
+ - lib/fiona7/attribute_readers/reference_as_linklist.rb
179
+ - lib/fiona7/attribute_readers/reference_as_string.rb
180
+ - lib/fiona7/attribute_readers/referencelist_as_linklist.rb
181
+ - lib/fiona7/attribute_readers/referencelist_as_text.rb
182
+ - lib/fiona7/attribute_readers/simple.rb
183
+ - lib/fiona7/attribute_readers/stringlist_as_text.rb
184
+ - lib/fiona7/attribute_readers/widgetlist_as_linklist.rb
185
+ - lib/fiona7/attribute_type_mapper.rb
186
+ - lib/fiona7/attribute_writers/attribute_writer.rb
187
+ - lib/fiona7/attribute_writers/binary_as_binary.rb
188
+ - lib/fiona7/attribute_writers/binary_as_linklist.rb
189
+ - lib/fiona7/attribute_writers/date_as_date.rb
190
+ - lib/fiona7/attribute_writers/factory.rb
191
+ - lib/fiona7/attribute_writers/helpers/html_serializer.rb
192
+ - lib/fiona7/attribute_writers/helpers/json_serializer.rb
193
+ - lib/fiona7/attribute_writers/helpers/link_serializer.rb
194
+ - lib/fiona7/attribute_writers/html_as_html.rb
195
+ - lib/fiona7/attribute_writers/link_as_linklist.rb
196
+ - lib/fiona7/attribute_writers/linklist_as_linklist.rb
197
+ - lib/fiona7/attribute_writers/multienum_as_multienum.rb
198
+ - lib/fiona7/attribute_writers/multienum_as_text.rb
199
+ - lib/fiona7/attribute_writers/number_as_string.rb
200
+ - lib/fiona7/attribute_writers/reference_as_linklist.rb
201
+ - lib/fiona7/attribute_writers/reference_as_string.rb
202
+ - lib/fiona7/attribute_writers/referencelist_as_linklist.rb
203
+ - lib/fiona7/attribute_writers/referencelist_as_text.rb
204
+ - lib/fiona7/attribute_writers/simple.rb
205
+ - lib/fiona7/attribute_writers/stringlist_as_text.rb
206
+ - lib/fiona7/attribute_writers/widgetlist_as_linklist.rb
164
207
  - lib/fiona7/blob_id_generator.rb
165
208
  - lib/fiona7/builder/batch_widget_writer.rb
166
209
  - lib/fiona7/builder/indirect_blob_builder.rb
@@ -209,6 +252,8 @@ files:
209
252
  - lib/fiona7/obj_classes_from_queries.rb
210
253
  - lib/fiona7/permission_volatile_cache.rb
211
254
  - lib/fiona7/permitted_mixin.rb
255
+ - lib/fiona7/prefetch/obj_prefetch.rb
256
+ - lib/fiona7/prefetch/widget_resolver_prefetch.rb
212
257
  - lib/fiona7/recursive_object_finder.rb
213
258
  - lib/fiona7/routers/rest_api.rb
214
259
  - lib/fiona7/routing_monkey_patch.rb
@@ -222,6 +267,7 @@ files:
222
267
  - lib/fiona7/scrivito_patches/cms_field_tag.rb
223
268
  - lib/fiona7/scrivito_patches/cms_rest_api.rb
224
269
  - lib/fiona7/scrivito_patches/cms_routing.rb
270
+ - lib/fiona7/scrivito_patches/date_attribute.rb
225
271
  - lib/fiona7/scrivito_patches/layout_tags.rb
226
272
  - lib/fiona7/scrivito_patches/link_parser.rb
227
273
  - lib/fiona7/scrivito_patches/log_subscriber.rb
@@ -238,6 +284,7 @@ files:
238
284
  - lib/fiona7/shadow_classes.rb
239
285
  - lib/fiona7/super_object_finder.rb
240
286
  - lib/fiona7/table_switcher.rb
287
+ - lib/fiona7/tools/attribute_remover.rb
241
288
  - lib/fiona7/type_loader.rb
242
289
  - lib/fiona7/type_register.rb
243
290
  - lib/fiona7/type_synchronizer.rb