scrivito_sdk 0.40.0 → 0.41.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/scrivito/objs_controller.rb +5 -1
- data/app/helpers/scrivito_helper.rb +22 -11
- data/app/models/scrivito/content_widget.rb +11 -0
- data/app/views/scrivito/content_widget/show.html.erb +7 -0
- data/config/ca-bundle.crt +1 -1
- data/config/cms_routes.rb +3 -1
- data/config/routes.rb +0 -1
- data/lib/assets/javascripts/scrivito_sdk.js +1 -1
- data/lib/assets/javascripts/scrivito_ui.js +415 -137
- data/lib/assets/stylesheets/scrivito_sdk.css +13 -0
- data/lib/assets/stylesheets/scrivito_ui.css +121 -0
- data/lib/generators/scrivito/install/install_generator.rb +6 -1
- data/lib/generators/scrivito/install/templates/app/views/download/embed.html.erb +1 -0
- data/lib/generators/scrivito/install/templates/app/views/image/embed.html.erb +1 -0
- data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb +4 -0
- data/lib/scrivito/basic_obj.rb +9 -1
- data/lib/scrivito/basic_widget.rb +5 -1
- data/lib/scrivito/cache/chainable.rb +52 -0
- data/lib/scrivito/cache/file_store.rb +26 -0
- data/lib/scrivito/cache/ram_store.rb +32 -0
- data/lib/scrivito/cache.rb +1 -40
- data/lib/scrivito/cache_garbage_collector.rb +1 -1
- data/lib/scrivito/cms_backend.rb +5 -5
- data/lib/scrivito/{cms_cache_storage.rb → cms_data_cache.rb} +22 -10
- data/lib/scrivito/cms_rest_api/widget_extractor.rb +1 -1
- data/lib/scrivito/configuration.rb +41 -6
- data/lib/scrivito/content_state.rb +6 -6
- data/lib/scrivito/controller_actions.rb +8 -2
- data/lib/scrivito/obj_params_parser.rb +4 -2
- data/lib/scrivito/workspace_data_from_service.rb +2 -2
- metadata +12 -5
@@ -81,15 +81,50 @@ module Scrivito
|
|
81
81
|
self.find_user_proc = find_user_proc
|
82
82
|
end
|
83
83
|
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
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
|
-
#
|
90
|
-
#
|
96
|
+
#
|
97
|
+
# Scrivito.configure do |config|
|
98
|
+
# config.cache_path = '/tmp/my_cache'
|
99
|
+
# end
|
100
|
+
#
|
91
101
|
def cache_path=(path)
|
92
|
-
|
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
|
-
|
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 =
|
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
|
-
|
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
|
-
|
48
|
+
CmsDataCache.read_obj_data(content_state_id, index, key)
|
49
49
|
end
|
50
50
|
|
51
51
|
def save_obj_classes_data(data)
|
52
|
-
|
52
|
+
CmsDataCache.write_obj_classes_data(content_state_id, data)
|
53
53
|
end
|
54
54
|
|
55
55
|
def find_obj_classes_data
|
56
|
-
|
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
|
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['
|
40
|
-
widget =
|
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 =
|
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
|
-
|
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.
|
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-
|
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/
|
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:
|
374
|
+
version: 1.3.1
|
368
375
|
requirements: []
|
369
376
|
rubyforge_project:
|
370
377
|
rubygems_version: 2.4.5
|