infopark_fiona7 0.71.1.12 → 1.1.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/fiona7_ui.js +67 -0
  3. data/app/assets/stylesheets/fiona7_ui.css.scss +29 -0
  4. data/app/controllers/fiona7/release_controller.rb +37 -75
  5. data/app/controllers/scrivito/cms_dispatch_controller.rb +2 -12
  6. data/app/controllers/scrivito/objs_controller.rb +41 -13
  7. data/app/controllers/scrivito/webservice_controller.rb +4 -3
  8. data/app/views/fiona7/release/preview.html.erb +73 -0
  9. data/config/routes.rb +3 -1
  10. data/infopark_fiona7.gemspec +1 -1
  11. data/lib/fiona7/assert.rb +4 -0
  12. data/lib/fiona7/attribute_name_mangler.rb +19 -0
  13. data/lib/fiona7/attribute_names_from_cms.rb +17 -0
  14. data/lib/fiona7/attribute_names_from_queries.rb +17 -0
  15. data/lib/fiona7/builder/obj_builder.rb +3 -2
  16. data/lib/fiona7/builder/obj_updater.rb +2 -2
  17. data/lib/fiona7/builder/widget_builder.rb +1 -1
  18. data/lib/fiona7/builder/widget_updater.rb +2 -2
  19. data/lib/fiona7/complex_object.rb +24 -0
  20. data/lib/fiona7/controllers/rest_api/obj_controller.rb +96 -24
  21. data/lib/fiona7/controllers/rest_api/workspace_controller.rb +23 -2
  22. data/lib/fiona7/engine.rb +11 -23
  23. data/lib/fiona7/facet_builder.rb +136 -0
  24. data/lib/fiona7/json/reverse_obj_decorator.rb +2 -0
  25. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk.rb +68 -10
  26. data/lib/fiona7/mode_switch/cms_routes/scrivito_sdk_slave.rb +66 -14
  27. data/lib/fiona7/mode_switch/views.rb +2 -2
  28. data/lib/fiona7/naive_search_engine.rb +40 -5
  29. data/lib/fiona7/obj_class_name_demangler.rb +11 -0
  30. data/lib/fiona7/obj_class_name_mangler.rb +11 -0
  31. data/lib/fiona7/obj_classes_from_cms.rb +14 -0
  32. data/lib/fiona7/obj_classes_from_queries.rb +11 -0
  33. data/lib/fiona7/recursive_object_finder.rb +149 -0
  34. data/lib/fiona7/routers/rest_api.rb +14 -1
  35. data/lib/fiona7/routing_monkey_patch.rb +5 -2
  36. data/lib/fiona7/scrivito_patches/attribute_serializer.rb +1 -1
  37. data/lib/fiona7/scrivito_patches/basic_obj.rb +4 -9
  38. data/lib/fiona7/scrivito_patches/basic_widget.rb +0 -9
  39. data/lib/fiona7/scrivito_patches/cms_backend.rb +11 -16
  40. data/lib/fiona7/scrivito_patches/cms_rest_api.rb +1 -1
  41. data/lib/fiona7/scrivito_patches/cms_routing.rb +50 -33
  42. data/lib/fiona7/scrivito_patches/link_parser.rb +6 -13
  43. data/lib/fiona7/scrivito_patches/log_subscriber.rb +18 -0
  44. data/lib/fiona7/scrivito_patches/preset_routes.rb +47 -0
  45. data/lib/fiona7/scrivito_patches/routing_extensions.rb +48 -0
  46. data/lib/fiona7/search_engine.rb +4 -0
  47. data/lib/fiona7/type_loader.rb +5 -4
  48. data/lib/fiona7/type_register.rb +13 -27
  49. data/lib/fiona7/type_synchronizer.rb +8 -6
  50. data/lib/fiona7/verity_search_engine.rb +77 -30
  51. data/lib/fiona7/version.rb +1 -1
  52. metadata +18 -13
  53. data/app/models/rails_connector/abstract_obj.rb +0 -24
  54. data/lib/fiona7/controllers/content_service/obj_controller.rb +0 -121
  55. data/lib/fiona7/controllers/content_service/workspace_controller.rb +0 -19
  56. data/lib/fiona7/recursive_link_resolver.rb +0 -93
  57. data/lib/fiona7/routers/content_service.rb +0 -19
  58. data/lib/fiona7/scrivito_patches/client_config.rb +0 -0
  59. data/lib/fiona7/scrivito_patches/controller_actions.rb +0 -6
  60. data/lib/fiona7/scrivito_patches/obj_class.rb +0 -16
  61. data/lib/fiona7/scrivito_patches/obj_data_from_rest.rb +0 -30
@@ -1,3 +1,3 @@
1
1
  module Fiona7
2
- VERSION = "0.71.1.12"
2
+ VERSION = "1.1.0.0.0"
3
3
  end
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: 0.71.1.12
4
+ version: 1.1.0.0.0
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-04-06 00:00:00.000000000 Z
11
+ date: 2016-02-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0.71'
33
+ version: 1.1.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0.71'
40
+ version: 1.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: scrivito_sdk
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -156,10 +156,10 @@ files:
156
156
  - app/models/fiona7/released_obj.rb
157
157
  - app/models/fiona7/write_obj.rb
158
158
  - app/models/fiona7_login_page.rb
159
- - app/models/rails_connector/abstract_obj.rb
160
159
  - app/models/x_container.rb
161
160
  - app/models/x_generic.rb
162
161
  - app/models/x_image.rb
162
+ - app/views/fiona7/release/preview.html.erb
163
163
  - app/views/fiona7_login_page/index.html.erb
164
164
  - app/views/layouts/fiona7_login_page_layout.html.erb
165
165
  - app/views/scrivito/ui/index.html.erb
@@ -169,6 +169,9 @@ files:
169
169
  - infopark_fiona7.gemspec
170
170
  - lib/fiona7/access_permission_check.rb
171
171
  - lib/fiona7/assert.rb
172
+ - lib/fiona7/attribute_name_mangler.rb
173
+ - lib/fiona7/attribute_names_from_cms.rb
174
+ - lib/fiona7/attribute_names_from_queries.rb
172
175
  - lib/fiona7/builder/batch_widget_writer.rb
173
176
  - lib/fiona7/builder/obj_builder.rb
174
177
  - lib/fiona7/builder/obj_class_builder.rb
@@ -177,9 +180,8 @@ files:
177
180
  - lib/fiona7/builder/widget_builder.rb
178
181
  - lib/fiona7/builder/widget_building.rb
179
182
  - lib/fiona7/builder/widget_updater.rb
183
+ - lib/fiona7/complex_object.rb
180
184
  - lib/fiona7/controller_helper.rb
181
- - lib/fiona7/controllers/content_service/obj_controller.rb
182
- - lib/fiona7/controllers/content_service/workspace_controller.rb
183
185
  - lib/fiona7/controllers/rest_api/blob_controller.rb
184
186
  - lib/fiona7/controllers/rest_api/obj_controller.rb
185
187
  - lib/fiona7/controllers/rest_api/workspace_controller.rb
@@ -187,6 +189,7 @@ files:
187
189
  - lib/fiona7/custom_verity_accessor.rb
188
190
  - lib/fiona7/editing_env_check.rb
189
191
  - lib/fiona7/engine.rb
192
+ - lib/fiona7/facet_builder.rb
190
193
  - lib/fiona7/fiona_connector_patches/basic_obj.rb
191
194
  - lib/fiona7/fiona_connector_patches/cms_accessible.rb
192
195
  - lib/fiona7/in_editable_view.rb
@@ -208,10 +211,13 @@ files:
208
211
  - lib/fiona7/mode_switch/composite.rb
209
212
  - lib/fiona7/mode_switch/views.rb
210
213
  - lib/fiona7/naive_search_engine.rb
214
+ - lib/fiona7/obj_class_name_demangler.rb
215
+ - lib/fiona7/obj_class_name_mangler.rb
216
+ - lib/fiona7/obj_classes_from_cms.rb
217
+ - lib/fiona7/obj_classes_from_queries.rb
211
218
  - lib/fiona7/permission_volatile_cache.rb
212
219
  - lib/fiona7/permitted_mixin.rb
213
- - lib/fiona7/recursive_link_resolver.rb
214
- - lib/fiona7/routers/content_service.rb
220
+ - lib/fiona7/recursive_object_finder.rb
215
221
  - lib/fiona7/routers/rest_api.rb
216
222
  - lib/fiona7/routing_monkey_patch.rb
217
223
  - lib/fiona7/scrivito_patches/attribute_content.rb
@@ -220,18 +226,17 @@ files:
220
226
  - lib/fiona7/scrivito_patches/basic_widget.rb
221
227
  - lib/fiona7/scrivito_patches/binary.rb
222
228
  - lib/fiona7/scrivito_patches/child_list_tag.rb
223
- - lib/fiona7/scrivito_patches/client_config.rb
224
229
  - lib/fiona7/scrivito_patches/cms_backend.rb
225
230
  - lib/fiona7/scrivito_patches/cms_field_tag.rb
226
231
  - lib/fiona7/scrivito_patches/cms_rest_api.rb
227
232
  - lib/fiona7/scrivito_patches/cms_routing.rb
228
- - lib/fiona7/scrivito_patches/controller_actions.rb
229
233
  - lib/fiona7/scrivito_patches/layout_tags.rb
230
234
  - lib/fiona7/scrivito_patches/link_parser.rb
235
+ - lib/fiona7/scrivito_patches/log_subscriber.rb
231
236
  - lib/fiona7/scrivito_patches/migrator.rb
232
- - lib/fiona7/scrivito_patches/obj_class.rb
233
- - lib/fiona7/scrivito_patches/obj_data_from_rest.rb
234
237
  - lib/fiona7/scrivito_patches/page_config.rb
238
+ - lib/fiona7/scrivito_patches/preset_routes.rb
239
+ - lib/fiona7/scrivito_patches/routing_extensions.rb
235
240
  - lib/fiona7/scrivito_patches/type_computer.rb
236
241
  - lib/fiona7/scrivito_patches/workspace.rb
237
242
  - lib/fiona7/scrivito_user.rb
@@ -1,24 +0,0 @@
1
- # Overwrite the class provided by reactor
2
- module RailsConnector
3
- if Fiona7.mode == :legacy
4
- root_class = ::RailsConnector::BasicObj
5
-
6
- AbstractObj = begin
7
- if ::Obj < root_class
8
- ::Obj
9
- else
10
- root_class
11
- end
12
- rescue NameError
13
- root_class
14
- end
15
- else
16
- AbstractObj = ::RailsConnector::BasicObj
17
- end
18
-
19
- class AbstractObj
20
- def self.compute_type(type_name)
21
- try_type { type_name.constantize } || self
22
- end
23
- end
24
- end
@@ -1,121 +0,0 @@
1
- require 'set'
2
- #require 'fiona7/released_obj'
3
- #require 'fiona7/edited_obj'
4
- require 'fiona7/assert'
5
- require 'fiona7/workspace'
6
- require 'fiona7/json/obj_decorator'
7
-
8
- module Fiona7
9
- module Controllers
10
- module ContentService
11
- class ObjController
12
- SCRIVITO_DIFF_MODE_BROKEN = true
13
-
14
- def fetch_multiple(params)
15
- @queries = params[:queries]
16
- workspace_id = params[:workspace_id]
17
- revision_id = params[:revision_id]
18
- @klass = self.get_matching_class(workspace_id, revision_id)
19
-
20
- all_refs = Set.new
21
- all_objs = Set.new
22
-
23
- @queries.each do |query|
24
- objs, refs = process_query(query)
25
-
26
- all_objs.merge(objs)
27
- all_refs << refs
28
- end
29
-
30
- r = {results: all_refs, objs: all_objs}
31
- return ::JSON.parse(::ActiveSupport::JSON.encode(r))
32
- end
33
-
34
- protected
35
- def get_matching_class(workspace_id, revision_id)
36
- Assert.input(
37
- workspace_id.nil? || (
38
- workspace_id == 'published' || workspace_id == 'rtc'
39
- ),
40
- "Invalid workspace_id: #{workspace_id}"
41
- )
42
-
43
- if workspace_id && !SCRIVITO_DIFF_MODE_BROKEN
44
- workspace_id == 'published' ? ReleasedObj : EditedObj
45
- elsif revision_id
46
- # iwe know that published revisions start with a 'f'
47
- # and rtc revisions start with a 'b'
48
- if revision_id[0] == 'f'
49
- ReleasedObj
50
- elsif revision_id[0] == 'b'
51
- EditedObj
52
- else
53
- Assert.input(
54
- false,
55
- "Invalid revision_id received: #{revision_id}"
56
- )
57
- end
58
- else
59
- Assert.input(
60
- false,
61
- "Neither workspace_id nor revision_id given, unable to identify content"
62
- )
63
- end
64
- end
65
-
66
- def process_query(query)
67
- objs = case query[:type]
68
- when "id"
69
- find_by_id(query[:param])
70
- when "path"
71
- find_by_path(query[:param])
72
- when "ppath"
73
- find_by_parent_path(query[:param])
74
- when "permalink"
75
- find_by_permalink(query[:param])
76
- else
77
- Assert.input(
78
- false,
79
- "Invalid query type #{query[:type]}"
80
- )
81
- end
82
-
83
- refs = {"refs" => objs.map {|o| {"id" => o.id.to_s} } }
84
- objs = objs.map {|o| JSON::ObjDecorator.new(@klass, o) }
85
-
86
- return objs, refs
87
- end
88
-
89
- def find_by_id(id)
90
- if id.kind_of?(Array)
91
- id = id.map(&:to_i)
92
- else
93
- id = id.to_i
94
- end
95
- @klass.where(obj_id: id).limit(1).to_a
96
- end
97
-
98
- def find_by_path(path)
99
- return [] if path.nil?
100
- return [] if path =~ /^\/_orphaned/
101
- path = path.gsub('.', '_')
102
- @klass.where(path: path).limit(1).to_a
103
- end
104
-
105
- def find_by_parent_path(path)
106
- return [] if path =~ /^\/_orphaned/
107
- parent = @klass.find_by_path(path)
108
- parent ? parent.children : []
109
- end
110
-
111
- def find_by_permalink(permalink)
112
- if permalink
113
- @klass.where(permalink: permalink).limit(1).to_a
114
- else
115
- []
116
- end
117
- end
118
- end
119
- end
120
- end
121
- end
@@ -1,19 +0,0 @@
1
- require 'fiona7/workspace'
2
- require 'fiona7/assert'
3
-
4
- module Fiona7
5
- module Controllers
6
- module ContentService
7
- class WorkspaceController
8
- def fetch(playload)
9
- id = playload[:workspace_id]
10
- id = id.to_sym
11
- return {} if id != :published && id != :rtc
12
-
13
- w = {'workspace' => Workspace.new(id)}
14
- return ::JSON.parse(::ActiveSupport::JSON.encode(w))
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,93 +0,0 @@
1
- module Fiona7
2
- class RecursiveLinkResolver
3
- attr_reader :id_map, :path_map
4
-
5
- def initialize(klass)
6
- @processed_ids = Set[]
7
- @id_map = {}
8
- @path_map = {}
9
- @klass = klass
10
- end
11
-
12
- def resolve(obj)
13
- resolve_recursive([obj])
14
- end
15
-
16
- protected
17
- def resolve_recursive(remaining_objects)
18
- return if remaining_objects.empty?
19
- return resolve_recursive(process_objects(remaining_objects))
20
- end
21
-
22
-
23
- def process_objects(objects)
24
- found_objects = []
25
-
26
- widget_id_to_obj_id_map = {}
27
-
28
- objects.each do |object|
29
- widget_id_to_obj_id_map.merge!(widget_id_to_obj_id_map_from_object(object))
30
- end
31
-
32
- @processed_ids.merge(objects.map(&:id))
33
-
34
- unprocessed_object_ids = filter_unprocessed_ids(widget_id_to_obj_id_map.values)
35
- if !unprocessed_object_ids.empty?
36
- found_objects = @klass.find(unprocessed_object_ids)
37
-
38
- id_object_map = create_id_object_map(found_objects)
39
-
40
- widget_id_to_obj_id_map.each do |widget_id, obj_id|
41
- if fetched_object = id_object_map[obj_id]
42
- @id_map[widget_id] = fetched_object.id
43
- @path_map[widget_id] = fetched_object.path
44
- end
45
- end
46
- end
47
-
48
- found_objects
49
- end
50
-
51
- def widget_id_to_obj_id_map_from_object(object)
52
- widget_id_to_obj_id_map = {}
53
-
54
- object.attr_values.each do |_, value|
55
- links_from_attribute = gather_links(value)
56
- widget_id_to_obj_id_map.merge!(links_from_attribute)
57
- end
58
-
59
- widget_id_to_obj_id_map
60
- end
61
-
62
-
63
- def gather_links(attribute_value)
64
- links = {}
65
-
66
- if attribute_value.kind_of?(Array) && !attribute_value.empty? && attribute_value.all? {|c| c.kind_of?(Hash)}
67
- attribute_value.each do |link|
68
- if (title = link['title'].presence) && (id = link['destination'].to_i) != 0
69
- links[title] = id
70
- end
71
- end
72
- end
73
-
74
- links
75
- end
76
-
77
- def filter_unprocessed_ids(object_ids)
78
- unprocessed_ids = []
79
- object_ids.each do |object_id|
80
- unprocessed_ids << object_id unless @processed_ids.include?(object_id)
81
- end
82
- unprocessed_ids
83
- end
84
-
85
- def create_id_object_map(objects)
86
- id_object_map = {}
87
- objects.each do |object|
88
- id_object_map[object.id] = object
89
- end
90
- id_object_map
91
- end
92
- end
93
- end
@@ -1,19 +0,0 @@
1
- require "fiona7/controllers/content_service/obj_controller"
2
- require "fiona7/controllers/content_service/workspace_controller"
3
-
4
- class Scrivito::ContentService
5
- class << self
6
- alias_method :original_query, :query
7
- def query(path, payload, options={})
8
- #$stdout.puts "DEBUG CS GET: #{path} < #{payload.inspect} >"
9
- case path
10
- when /\Aworkspaces\/query/
11
- Fiona7::Controllers::ContentService::WorkspaceController.new.fetch(payload)
12
- when /\Aobjs\/query/
13
- Fiona7::Controllers::ContentService::ObjController.new.fetch_multiple(payload)
14
- else
15
- original_query(path, payload, options)
16
- end
17
- end
18
- end
19
- end
File without changes
@@ -1,6 +0,0 @@
1
- require 'scrivito/controller_actions'
2
-
3
- module Scrivito
4
- module ControllerActions
5
- end
6
- end
@@ -1,16 +0,0 @@
1
- require 'scrivito/obj_class'
2
-
3
- module Scrivito
4
- class ObjClass
5
- # there are no legacy types.
6
- def is_binary
7
- raise ScrivitoError,
8
- %(`is_binary' and `binary?' can only be called on ObjClasses with a legacy_type.)
9
- end
10
- alias_method :binary?, :is_binary
11
-
12
- def legacy_type?
13
- false
14
- end
15
- end
16
- end
@@ -1,30 +0,0 @@
1
- require 'scrivito/backend/obj_data_from_rest'
2
-
3
- module Scrivito
4
- module Backend
5
- class ObjDataFromRest
6
- private
7
- # nil values for links are handled incorrectly
8
- def legacy_compatible(value, type)
9
- if type == "linklist"
10
- value.map(&method(:legacy_link)).compact
11
- elsif type == "link"
12
- legacy_link(value)
13
- else
14
- value
15
- end
16
- end
17
-
18
- # nil values for links are handled incorrectly
19
- def legacy_link(link)
20
- return nil unless link
21
- return link unless link["obj_id"]
22
-
23
- transformed = link.dup
24
- transformed["destination"] = transformed.delete("obj_id")
25
-
26
- transformed
27
- end
28
- end
29
- end
30
- end