scrivito_sdk 0.40.0 → 0.41.0.rc1

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/scrivito/objs_controller.rb +5 -1
  3. data/app/helpers/scrivito_helper.rb +22 -11
  4. data/app/models/scrivito/content_widget.rb +11 -0
  5. data/app/views/scrivito/content_widget/show.html.erb +7 -0
  6. data/config/ca-bundle.crt +1 -1
  7. data/config/cms_routes.rb +3 -1
  8. data/config/routes.rb +0 -1
  9. data/lib/assets/javascripts/scrivito_sdk.js +1 -1
  10. data/lib/assets/javascripts/scrivito_ui.js +415 -137
  11. data/lib/assets/stylesheets/scrivito_sdk.css +13 -0
  12. data/lib/assets/stylesheets/scrivito_ui.css +121 -0
  13. data/lib/generators/scrivito/install/install_generator.rb +6 -1
  14. data/lib/generators/scrivito/install/templates/app/views/download/embed.html.erb +1 -0
  15. data/lib/generators/scrivito/install/templates/app/views/image/embed.html.erb +1 -0
  16. data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb +4 -0
  17. data/lib/scrivito/basic_obj.rb +9 -1
  18. data/lib/scrivito/basic_widget.rb +5 -1
  19. data/lib/scrivito/cache/chainable.rb +52 -0
  20. data/lib/scrivito/cache/file_store.rb +26 -0
  21. data/lib/scrivito/cache/ram_store.rb +32 -0
  22. data/lib/scrivito/cache.rb +1 -40
  23. data/lib/scrivito/cache_garbage_collector.rb +1 -1
  24. data/lib/scrivito/cms_backend.rb +5 -5
  25. data/lib/scrivito/{cms_cache_storage.rb → cms_data_cache.rb} +22 -10
  26. data/lib/scrivito/cms_rest_api/widget_extractor.rb +1 -1
  27. data/lib/scrivito/configuration.rb +41 -6
  28. data/lib/scrivito/content_state.rb +6 -6
  29. data/lib/scrivito/controller_actions.rb +8 -2
  30. data/lib/scrivito/obj_params_parser.rb +4 -2
  31. data/lib/scrivito/workspace_data_from_service.rb +2 -2
  32. metadata +12 -5
@@ -81,15 +81,50 @@ module Scrivito
81
81
  self.find_user_proc = find_user_proc
82
82
  end
83
83
 
84
- # The +Scrivito+ makes heavy use of filesystem caching.
85
- # Use this method to configure the directory that should be used to store cached data.
86
- # By default, +RAILS_ROOT/tmp/scrivito_cache+ will be used.
84
+ #
85
+ # Set the path for the filesystem cache.
86
+ #
87
+ # +Scrivito+ makes heavy use of filesystem caching. Use this method to configure the directory
88
+ # that should be used to store cached data. By default, +RAILS_ROOT/tmp/scrivito_cache+ will
89
+ # be used.
90
+ #
91
+ # @api public
92
+ #
87
93
  # @param path [String] Path to directory that should be used to store cached data.
94
+ #
88
95
  # @example Configure +Scrivito+ to store its cache under +/tmp/my_cache+.
89
- # Scrivito::Configuration.cache_path = '/tmp/my_cache'
90
- # @api public
96
+ #
97
+ # Scrivito.configure do |config|
98
+ # config.cache_path = '/tmp/my_cache'
99
+ # end
100
+ #
91
101
  def cache_path=(path)
92
- CmsCacheStorage.backend_cache = ActiveSupport::Cache::FileStore.new(path)
102
+ CmsDataCache.cache_path = path
103
+ end
104
+
105
+ #
106
+ # Sets the second level cache.
107
+ #
108
+ # If it is set, then +Scrivito+ will additionaly store its cache in both: the filesystem cache
109
+ # and the second level cache. Also +Scrivito+ will search in the second level cache if
110
+ # searching in the filesystem cache returns no results. If the second level cache returns
111
+ # results, then the results will be store in the filesystem cache.
112
+ #
113
+ # By default it is not set.
114
+ #
115
+ # @api public
116
+ #
117
+ # @param cache_store [ActiveSupport::Cache::Store] cache store to be used as the second level
118
+ # cache
119
+ #
120
+ # @example Use Memcached as the second level cache (https://rubygems.org/gems/dalli)
121
+ #
122
+ # Scrivito.configure do |config|
123
+ # config.second_level_cache = ActiveSupport::Cache::DalliStore.new("localhost", "server-downstairs.localnetwork:8229")
124
+ # end
125
+ #
126
+ def second_level_cache=(cache_store)
127
+ CmsDataCache.second_level_cache = cache_store
93
128
  end
94
129
 
95
130
  #
@@ -11,14 +11,14 @@ class ContentState < Struct.new(:content_state_id, :changes, :changes_index, :fr
11
11
  def create(attributes)
12
12
  new(attributes).tap do |content_state|
13
13
  content_state.index_changes!
14
- CmsCacheStorage.write_content_state(content_state.content_state_id, content_state.to_hash)
14
+ CmsDataCache.write_content_state(content_state.content_state_id, content_state.to_hash)
15
15
  end
16
16
  end
17
17
 
18
18
  # Finds a previously saved content state.
19
19
  # Returns nil if not found.
20
20
  def find(content_state_id)
21
- if content_state_data = CmsCacheStorage.read_content_state(content_state_id)
21
+ if content_state_data = CmsDataCache.read_content_state(content_state_id)
22
22
  new(content_state_data)
23
23
  end
24
24
  end
@@ -38,22 +38,22 @@ class ContentState < Struct.new(:content_state_id, :changes, :changes_index, :fr
38
38
  # Stores arbitrary data in cache.
39
39
  # Cache key is build from given index and key.
40
40
  def save_obj_data(index, key, data)
41
- CmsCacheStorage.write_obj_data(content_state_id, index, key, data)
41
+ CmsDataCache.write_obj_data(content_state_id, index, key, data)
42
42
  end
43
43
 
44
44
  # Fetches previously stored arbitrary data from cache.
45
45
  # Returns nil if nothing found.
46
46
  # Cache key is build from given index and key.
47
47
  def find_obj_data(index, key)
48
- CmsCacheStorage.read_obj_data(content_state_id, index, key)
48
+ CmsDataCache.read_obj_data(content_state_id, index, key)
49
49
  end
50
50
 
51
51
  def save_obj_classes_data(data)
52
- CmsCacheStorage.write_obj_classes_data(content_state_id, data)
52
+ CmsDataCache.write_obj_classes_data(content_state_id, data)
53
53
  end
54
54
 
55
55
  def find_obj_classes_data
56
- CmsCacheStorage.read_obj_classes_data(content_state_id)
56
+ CmsDataCache.read_obj_classes_data(content_state_id)
57
57
  end
58
58
 
59
59
  # Fetches and caches the ancestor.
@@ -17,9 +17,10 @@ module ControllerActions
17
17
 
18
18
  included do
19
19
  before_filter :require_authenticated_editor, only: [
20
- :details_page,
21
20
  :show_widget,
22
21
  :widget_details,
22
+ :page_details,
23
+ :resource_details,
23
24
  ]
24
25
 
25
26
  before_filter :load_object
@@ -48,7 +49,12 @@ module ControllerActions
48
49
  render template_path, layout: 'scrivito_dialog', locals: {widget: widget}
49
50
  end
50
51
 
51
- def details_page
52
+ def page_details
53
+ assert_dialog_layout
54
+ render @obj.details_view_path, layout: 'scrivito_dialog'
55
+ end
56
+
57
+ def resource_details
52
58
  assert_dialog_layout
53
59
  @scrivito_resource = editing_context.selected_workspace.objs
54
60
  .find_including_deleted(params[:resource_id])
@@ -36,8 +36,10 @@ module Scrivito
36
36
  case action
37
37
  when 'create' then Widget.new(widget_params)
38
38
  when 'copy'
39
- widget_id = widget_params['src_widget_id']
40
- widget = Obj.find(widget_params['src_obj_id']).widgets[widget_id]
39
+ widget_id = widget_params['widget_id']
40
+ widget = Workspace.find(widget_params['workspace_id'])
41
+ .objs.find(widget_params['obj_id'])
42
+ .widgets[widget_id]
41
43
  raise ResourceNotFound, "Could not find Widget with id #{widget_id}" unless widget
42
44
  widget.copy
43
45
  else raise UnknownWidgetAction
@@ -5,7 +5,7 @@ class WorkspaceDataFromService
5
5
  # Fetches a workspace data previously store in cache storage.
6
6
  # Returns nil if not found.
7
7
  def find_from_cache(id)
8
- if data = CmsCacheStorage.read_workspace_data(id)
8
+ if data = CmsDataCache.read_workspace_data(id)
9
9
  new(data)
10
10
  end
11
11
  end
@@ -56,7 +56,7 @@ class WorkspaceDataFromService
56
56
  # Also creates an appropriate content state if needed.
57
57
  def store_in_cache
58
58
  create_content_state if content_state_id
59
- CmsCacheStorage.write_workspace_data(id, to_hash)
59
+ CmsDataCache.write_workspace_data(id, to_hash)
60
60
  end
61
61
 
62
62
  private
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrivito_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.40.0
4
+ version: 0.41.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Infopark AG
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-26 00:00:00.000000000 Z
11
+ date: 2015-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable
@@ -167,9 +167,11 @@ files:
167
167
  - app/controllers/scrivito/webservice_controller.rb
168
168
  - app/controllers/scrivito/workspaces_controller.rb
169
169
  - app/helpers/scrivito_helper.rb
170
+ - app/models/scrivito/content_widget.rb
170
171
  - app/views/google_maps_widget/show.html.erb
171
172
  - app/views/scrivito/_editing_auth_warning.html.erb
172
173
  - app/views/scrivito/blobs/upload_permission.json.jbuilder
174
+ - app/views/scrivito/content_widget/show.html.erb
173
175
  - app/views/scrivito/objs/copy_widget.html.erb
174
176
  - app/views/scrivito/objs/create_widget.html.erb
175
177
  - app/views/scrivito/objs/format_missing_error.json.jbuilder
@@ -219,8 +221,10 @@ files:
219
221
  - lib/generators/scrivito/install/templates/app/models/page.rb
220
222
  - lib/generators/scrivito/install/templates/app/models/text_widget.rb
221
223
  - lib/generators/scrivito/install/templates/app/models/widget.rb
224
+ - lib/generators/scrivito/install/templates/app/views/download/embed.html.erb
222
225
  - lib/generators/scrivito/install/templates/app/views/headline_widget/show.html.erb
223
226
  - lib/generators/scrivito/install/templates/app/views/headline_widget/thumbnail.html.erb
227
+ - lib/generators/scrivito/install/templates/app/views/image/embed.html.erb
224
228
  - lib/generators/scrivito/install/templates/app/views/image_widget/show.html.erb
225
229
  - lib/generators/scrivito/install/templates/app/views/image_widget/thumbnail.html.erb
226
230
  - lib/generators/scrivito/install/templates/app/views/layouts/scrivito_dialog.html.erb
@@ -257,13 +261,16 @@ files:
257
261
  - lib/scrivito/basic_widget.rb
258
262
  - lib/scrivito/binary.rb
259
263
  - lib/scrivito/cache.rb
264
+ - lib/scrivito/cache/chainable.rb
265
+ - lib/scrivito/cache/file_store.rb
266
+ - lib/scrivito/cache/ram_store.rb
260
267
  - lib/scrivito/cache_garbage_collector.rb
261
268
  - lib/scrivito/cache_middleware.rb
262
269
  - lib/scrivito/child_list_tag.rb
263
270
  - lib/scrivito/client_config.rb
264
271
  - lib/scrivito/client_error.rb
265
272
  - lib/scrivito/cms_backend.rb
266
- - lib/scrivito/cms_cache_storage.rb
273
+ - lib/scrivito/cms_data_cache.rb
267
274
  - lib/scrivito/cms_dispatch_controller.rb
268
275
  - lib/scrivito/cms_env.rb
269
276
  - lib/scrivito/cms_field_tag.rb
@@ -362,9 +369,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
362
369
  version: 2.0.0
363
370
  required_rubygems_version: !ruby/object:Gem::Requirement
364
371
  requirements:
365
- - - '>='
372
+ - - '>'
366
373
  - !ruby/object:Gem::Version
367
- version: '0'
374
+ version: 1.3.1
368
375
  requirements: []
369
376
  rubyforge_project:
370
377
  rubygems_version: 2.4.5