scrivito_sdk 0.18.1 → 0.30.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/blobs_controller.rb +1 -2
  3. data/app/controllers/scrivito/default_cms_controller.rb +9 -75
  4. data/app/controllers/scrivito/objs_controller.rb +107 -119
  5. data/app/controllers/scrivito/tasks_controller.rb +1 -1
  6. data/app/controllers/scrivito/users_controller.rb +1 -1
  7. data/app/controllers/scrivito/webservice_controller.rb +6 -2
  8. data/app/controllers/scrivito/workspaces_controller.rb +57 -17
  9. data/app/helpers/scrivito_helper.rb +285 -0
  10. data/app/views/google_maps_widget/show.html.erb +1 -0
  11. data/app/views/scrivito/_editing_auth_warning.html.erb +43 -0
  12. data/app/views/scrivito/blobs/upload_permission.json.jbuilder +1 -0
  13. data/app/views/scrivito/objs/copy.json.jbuilder +1 -0
  14. data/app/views/scrivito/objs/copy_widget.html.erb +1 -1
  15. data/app/views/scrivito/objs/create.json.jbuilder +1 -0
  16. data/app/views/scrivito/objs/create_widget.html.erb +1 -1
  17. data/app/views/scrivito/objs/details.json.jbuilder +1 -0
  18. data/app/views/scrivito/objs/format_missing_error.json.jbuilder +1 -0
  19. data/app/views/scrivito/objs/modification.json.jbuilder +1 -0
  20. data/app/views/scrivito/objs/page_class_selection.json.jbuilder +1 -0
  21. data/app/views/scrivito/objs/search.json.jbuilder +6 -0
  22. data/app/views/scrivito/objs/search_only_size.json.jbuilder +1 -0
  23. data/app/views/scrivito/objs/update.json.jbuilder +1 -0
  24. data/app/views/scrivito/objs/widget_class_selection.json.jbuilder +1 -0
  25. data/app/views/scrivito/objs/widget_modification.json.jbuilder +1 -0
  26. data/app/views/scrivito/tasks/show.json.jbuilder +3 -0
  27. data/app/views/scrivito/users/suggest.json.jbuilder +1 -0
  28. data/app/views/scrivito/webservice/empty.json +1 -0
  29. data/app/views/scrivito/webservice/error.json.jbuilder +2 -0
  30. data/app/views/scrivito/workspaces/_workspace.json.jbuilder +5 -0
  31. data/app/views/scrivito/workspaces/check.json.jbuilder +1 -0
  32. data/app/views/scrivito/workspaces/create.json.jbuilder +1 -0
  33. data/app/views/scrivito/workspaces/index.json.jbuilder +1 -0
  34. data/app/views/scrivito/workspaces/show.json.jbuilder +1 -0
  35. data/app/views/scrivito/workspaces/task.json.jbuilder +5 -0
  36. data/config/ca-bundle.crt +259 -234
  37. data/config/cms_routes.rb +2 -2
  38. data/config/routes.rb +3 -0
  39. data/lib/assets/javascripts/{scrivito_editing.js → scrivito_sdk.js} +1662 -1180
  40. data/lib/assets/stylesheets/{scrivito_editing.css → scrivito_sdk.css} +242 -6
  41. data/lib/generators/scrivito/install/install_generator.rb +62 -0
  42. data/lib/generators/scrivito/install/templates/app/controllers/cms_controller.rb +3 -0
  43. data/lib/generators/scrivito/install/templates/app/controllers/page_controller.rb +2 -0
  44. data/lib/generators/scrivito/install/templates/app/models/headline_widget.rb +7 -0
  45. data/lib/generators/scrivito/install/templates/app/models/image.rb +5 -0
  46. data/lib/generators/scrivito/install/templates/app/models/image_widget.rb +7 -0
  47. data/lib/generators/scrivito/install/templates/app/models/obj.rb +2 -0
  48. data/lib/generators/scrivito/install/templates/app/models/page.rb +8 -0
  49. data/lib/generators/scrivito/install/templates/app/models/text_widget.rb +7 -0
  50. data/lib/generators/scrivito/install/templates/app/models/widget.rb +2 -0
  51. data/lib/generators/scrivito/install/templates/app/views/headline_widget/show.html.erb +1 -0
  52. data/lib/generators/scrivito/install/templates/app/views/headline_widget/thumbnail.html.erb +3 -0
  53. data/lib/generators/scrivito/install/templates/app/views/image_widget/show.html.erb +1 -0
  54. data/lib/generators/scrivito/install/templates/app/views/image_widget/thumbnail.html.erb +3 -0
  55. data/lib/generators/scrivito/install/templates/app/views/page/details.html.erb +1 -0
  56. data/lib/generators/scrivito/install/templates/app/views/page/index.html.erb +16 -0
  57. data/lib/generators/scrivito/install/templates/app/views/page/thumbnail.html.erb +3 -0
  58. data/lib/generators/scrivito/install/templates/app/views/text_widget/show.html.erb +1 -0
  59. data/lib/generators/scrivito/install/templates/app/views/text_widget/thumbnail.html.erb +3 -0
  60. data/lib/generators/scrivito/install/templates/config/initializers/scrivito.rb +10 -0
  61. data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito.rb +49 -0
  62. data/lib/generators/scrivito/migration/USAGE +9 -0
  63. data/lib/generators/{cms → scrivito}/migration/migration_generator.rb +4 -9
  64. data/lib/generators/{cms → scrivito}/migration/templates/migration.erb +3 -3
  65. data/lib/generators/{cms → scrivito}/widget/templates/details.html.erb +0 -0
  66. data/lib/generators/{cms → scrivito}/widget/templates/migration.erb +0 -0
  67. data/lib/generators/{cms → scrivito}/widget/templates/model.erb +0 -0
  68. data/lib/generators/{cms → scrivito}/widget/templates/show.html.erb +0 -0
  69. data/lib/generators/scrivito/widget/templates/thumbnail.html.erb +3 -0
  70. data/lib/generators/{cms → scrivito}/widget/widget_generator.rb +3 -2
  71. data/lib/obj.rb +17 -3
  72. data/lib/scrivito/attribute_collection.rb +7 -12
  73. data/lib/scrivito/attribute_content.rb +31 -12
  74. data/lib/scrivito/basic_obj.rb +186 -96
  75. data/lib/scrivito/basic_widget.rb +25 -10
  76. data/lib/scrivito/binary.rb +75 -0
  77. data/lib/scrivito/cache_garbage_collector.rb +19 -4
  78. data/lib/scrivito/child_list_tag.rb +108 -0
  79. data/lib/scrivito/client_config.rb +2 -1
  80. data/lib/scrivito/client_error.rb +3 -2
  81. data/lib/scrivito/cms_backend.rb +81 -16
  82. data/lib/scrivito/cms_dispatch_controller.rb +7 -0
  83. data/lib/scrivito/cms_env.rb +0 -2
  84. data/lib/scrivito/cms_field_tag.rb +44 -35
  85. data/lib/scrivito/cms_rest_api.rb +23 -6
  86. data/lib/scrivito/cms_rest_api/attribute_serializer.rb +1 -1
  87. data/lib/scrivito/cms_routing.rb +120 -0
  88. data/lib/scrivito/configuration.rb +69 -58
  89. data/lib/scrivito/connection_manager.rb +30 -1
  90. data/lib/scrivito/content_service.rb +10 -7
  91. data/lib/scrivito/controller_actions.rb +108 -0
  92. data/lib/scrivito/diff.rb +30 -15
  93. data/lib/scrivito/editing_context.rb +4 -0
  94. data/lib/scrivito/editing_context_helper.rb +19 -0
  95. data/lib/scrivito/editing_context_middleware.rb +20 -1
  96. data/lib/scrivito/image_tag_helper.rb +44 -0
  97. data/lib/scrivito/layout_tags.rb +33 -0
  98. data/lib/scrivito/link.rb +4 -2
  99. data/lib/scrivito/membership.rb +0 -8
  100. data/lib/scrivito/migrations.rb +0 -1
  101. data/lib/scrivito/migrations/installer.rb +1 -1
  102. data/lib/scrivito/migrations/migration.rb +0 -2
  103. data/lib/scrivito/migrations/migrator.rb +2 -3
  104. data/lib/scrivito/obj_class.rb +64 -16
  105. data/lib/scrivito/obj_class_data.rb +4 -0
  106. data/lib/scrivito/obj_search_enumerator.rb +1 -1
  107. data/lib/scrivito/routing_helper.rb +42 -0
  108. data/lib/scrivito/{engine.rb → sdk_engine.rb} +15 -29
  109. data/lib/scrivito/tag_renderer.rb +40 -0
  110. data/lib/scrivito/test_request.rb +40 -0
  111. data/lib/scrivito/type_computer.rb +1 -6
  112. data/lib/scrivito/user.rb +33 -15
  113. data/lib/scrivito/user_definition.rb +34 -6
  114. data/lib/scrivito/widget_tag.rb +67 -0
  115. data/lib/scrivito/workspace.rb +12 -24
  116. data/lib/scrivito_sdk.rb +17 -1
  117. data/lib/tasks/cache.rake +4 -5
  118. data/lib/tasks/migration.rake +1 -1
  119. data/lib/widget.rb +21 -3
  120. metadata +119 -70
  121. data/README +0 -6
  122. data/app/controllers/cms_controller.rb +0 -7
  123. data/app/helpers/cms_helper.rb +0 -7
  124. data/app/helpers/cms_routing_helper.rb +0 -7
  125. data/app/helpers/scrivito/cms_asset_helper.rb +0 -110
  126. data/app/helpers/scrivito/cms_tag_helper.rb +0 -232
  127. data/app/helpers/scrivito/default_cms_helper.rb +0 -21
  128. data/app/helpers/scrivito/default_cms_routing_helper.rb +0 -128
  129. data/app/helpers/scrivito/display_helper.rb +0 -64
  130. data/app/helpers/scrivito/editing_helper.rb +0 -32
  131. data/app/helpers/scrivito/layout_helper.rb +0 -21
  132. data/app/models/named_link.rb +0 -2
  133. data/app/views/cms/_index.html.erb +0 -7
  134. data/app/views/cms/index.html.erb +0 -1
  135. data/app/views/scrivito/_editing_javascript.html.erb +0 -7
  136. data/app/views/scrivito/default_cms/show_widget.html.erb +0 -1
  137. data/lib/assets/stylesheets/scrivito.css +0 -199
  138. data/lib/generators/cms/migration/USAGE +0 -9
  139. data/lib/generators/cms/widget/templates/thumbnail.html.erb +0 -2
  140. data/lib/scrivito/blob.rb +0 -48
  141. data/lib/scrivito/cms_accessible.rb +0 -30
  142. data/lib/scrivito/cms_rest_api/blob_uploader.rb +0 -18
  143. data/lib/scrivito/cms_test_request.rb +0 -23
  144. data/lib/scrivito/migrations/migration_dsl.rb +0 -180
@@ -1,23 +0,0 @@
1
- module Scrivito
2
- module CmsTestRequest
3
- def for_cms_object(test_obj=nil)
4
- # prepare the env as if the given obj was loaded by CmsEnv
5
- env[Scrivito::CmsEnv::OBJ_ENV_KEY] = test_obj if test_obj
6
- class << self
7
- # This special behaviour is necessary for testing controllers that descend from DefaultCmsController.
8
- # These controllers do not have explicit routes by default.
9
- # Instead, they are reached via the CmsDispatchController.
10
- # The TestRequest must therefore use CmsDispatchController as a fallback route.
11
- def assign_parameters(routes, controller_path, action, parameters = {})
12
- super(routes, controller_path, action, parameters)
13
- rescue ActionController::RoutingError, AbstractController::ActionNotFound => e
14
- begin
15
- super(routes, "scrivito/cms_dispatch", action, parameters)
16
- rescue ActionController::RoutingError, AbstractController::ActionNotFound
17
- raise e
18
- end
19
- end
20
- end
21
- end
22
- end
23
- end
@@ -1,180 +0,0 @@
1
- module Scrivito
2
- # @api public
3
- module Migrations
4
- # @api public
5
- module MigrationDsl
6
- # Adds an attribute to an object class.
7
- #
8
- # @deprecated Please use {AttributeCollection#add} instead.
9
- #
10
- # @example Add "test" attribute to object class "Foo.
11
- #
12
- # add_attribute_to('Foo', { name: 'test', type: 'string' })
13
- #
14
- # @param obj_class_name [String] The class name of the object class.
15
- # @param params [Hash] The definition of the new attribute.
16
- #
17
- # @return nothing
18
- def add_attribute_to(obj_class_name, params)
19
- Deprecation.warn_method(
20
- 'add_attribute_to',
21
- 'ObjClass#attributes.add(Attribute.new(params))'
22
- )
23
-
24
- attributes = get_obj_class(obj_class_name)['attributes']
25
- attributes << params
26
-
27
- update_obj_class(obj_class_name, attributes: attributes)
28
- end
29
-
30
- # Deletes an attribute from an object class.
31
- #
32
- # @deprecated Please use {Attribute#destroy} instead.
33
- #
34
- # @example Delete "test" attribute from object class "Foo.
35
- #
36
- # delete_attribute_from('Foo', 'test')
37
- #
38
- # @param obj_class_name [String] The class name of the object class.
39
- # @param attribute_name [String] The name of the attribute that should be
40
- # deleted.
41
- #
42
- # @return nothing
43
- def delete_attribute_from(obj_class_name, attribute_name)
44
- Deprecation.warn_method(
45
- 'delete_attribute_from',
46
- 'ObjClass#attributes[attribute_name].destroy()'
47
- )
48
-
49
- attributes = get_obj_class(obj_class_name)['attributes']
50
- attributes = attributes.delete_if do |attribute|
51
- attribute['name'] == attribute_name.to_s
52
- end
53
-
54
- update_obj_class(obj_class_name, attributes: attributes)
55
- end
56
-
57
- # Updates an attribute for an object class.
58
- #
59
- # @deprecated Please use {Attribute#update} instead.
60
- #
61
- # @example Update "test" attribute for object class "Foo.
62
- #
63
- # update_attribute_for('Foo', 'test', { title: 'New Title' })
64
- #
65
- # @param obj_class_name [String] The class name of the object class.
66
- # @param attribute_name [String] The name of the attribute that should be
67
- # updated.
68
- # @param params [Hash] Hash of updated attributes.
69
- #
70
- # @return nothing
71
- def update_attribute_for(obj_class_name, attribute_name, params)
72
- Deprecation.warn_method(
73
- 'update_attribute_for',
74
- 'ObjClass#attributes[attribute_name].update(params)'
75
- )
76
-
77
- attribute_name = attribute_name.to_s
78
- attributes = get_obj_class(obj_class_name)['attributes']
79
- found = false
80
-
81
- attributes.each_with_index do |attribute, index|
82
- if attribute['name'] == attribute_name
83
- attributes[index] = attribute.merge(params.stringify_keys)
84
- update_obj_class(obj_class_name, attributes: attributes)
85
-
86
- found = true
87
-
88
- break
89
- end
90
- end
91
-
92
- unless found
93
- raise ArgumentError.new("Object class '#{obj_class_name}' does not have attribute '#{attribute_name}'.")
94
- end
95
- end
96
-
97
- # Creates a CMS object class.
98
- #
99
- # @deprecated Please use {ObjClass.create} instead.
100
- #
101
- # @example Create "Test" Object Class
102
- #
103
- # create_obj_class(name: 'Test', type: 'publication')
104
- #
105
- # @param attributes [Hash] The attributes and their values of the new
106
- # CMS object class.
107
- #
108
- # @return nothing
109
- # @api public
110
- def create_obj_class(attributes = {})
111
- Deprecation.warn_method('create_obj_class', 'ObjClass.create(attributes)')
112
-
113
- endpoint = "workspaces/#{Workspace.current.id}/obj_classes"
114
-
115
- CmsRestApi.post(endpoint, obj_class: attributes)
116
- end
117
-
118
- # Fetches all object attributes and their values.
119
- #
120
- # @deprecated Please use {BasicObj.find} instead.
121
- #
122
- # @example Get all attributes for the obj with id "abc123"
123
- #
124
- # get_obj('abc123')
125
- #
126
- # @param id [String] The ID of the CMS object.
127
- #
128
- # @return [Hash] a hash with attributes and their values.
129
- # @api public
130
- def get_obj(id)
131
- Deprecation.warn_method('get_obj', 'Obj.find(id)')
132
-
133
- endpoint = "workspaces/#{Workspace.current.id}/objs/#{id}"
134
-
135
- CmsRestApi.get(endpoint)
136
- end
137
-
138
- # Fetches all object class attributes and their values.
139
- #
140
- # @deprecated Please use {ObjClass.find} instead.
141
- #
142
- # @example Get all attributes for the object class "Test"
143
- #
144
- # get_obj_class('Test')
145
- #
146
- # @param id [String] The ID of the object class.
147
- #
148
- # @return [Hash] a hash with attributes and their values.
149
- # @api public
150
- def get_obj_class(id)
151
- Deprecation.warn_method('get_obj_class', 'ObjClass.find(id)')
152
-
153
- endpoint = "workspaces/#{Workspace.current.id}/obj_classes/#{id}"
154
-
155
- CmsRestApi.get(endpoint)
156
- end
157
-
158
- # Updates a CMS object class.
159
- #
160
- # @deprecated Please use {ObjClass#update} instead.
161
- #
162
- # @example Update the title of the "Test" Object Class
163
- #
164
- # update_obj_class('Test', title: 'Test Title')
165
- #
166
- # @param id [String] The ID of the CMS object class.
167
- # @param attributes [Hash] The updated attributes and their values.
168
- #
169
- # @return nothing
170
- # @api public
171
- def update_obj_class(id, attributes = {})
172
- Deprecation.warn_method('update_obj_class', 'ObjClass#update(attributes)')
173
-
174
- endpoint = "workspaces/#{Workspace.current.id}/obj_classes/#{id}"
175
-
176
- CmsRestApi.put(endpoint, obj_class: attributes)
177
- end
178
- end
179
- end
180
- end