scrivito_sdk 0.66.0 → 0.70.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/blobs_controller.rb +5 -0
- data/app/controllers/scrivito/objs_controller.rb +2 -1
- data/app/controllers/scrivito/ui_controller.rb +33 -3
- data/app/helpers/scrivito_helper.rb +14 -20
- data/app/views/scrivito/objs/update.json.jbuilder +1 -1
- data/app/views/scrivito/ui/index.html.erb +1 -1
- data/app/views/scrivito/webservice/_workspace.json.jbuilder +2 -1
- data/config/ca-bundle.crt +1 -1
- data/config/precedence_routes.rb +3 -2
- data/lib/assets/javascripts/scrivito.js +46 -0
- data/lib/assets/javascripts/scrivito_ui.js +931 -501
- data/lib/assets/stylesheets/scrivito.css +1 -0
- data/lib/assets/stylesheets/scrivito_ui.css +1 -1
- data/lib/generators/scrivito/install/templates/app/views/page/index.html.erb +3 -3
- data/lib/generators/scrivito/page/page_generator.rb +3 -0
- data/lib/generators/scrivito/page/templates/model.erb +3 -0
- data/lib/generators/scrivito/widget/templates/model.erb +3 -0
- data/lib/generators/scrivito/widget/widget_generator.rb +3 -0
- data/lib/scrivito/attribute_content.rb +93 -60
- data/lib/scrivito/attribute_definition.rb +3 -3
- data/lib/scrivito/attribute_serializer.rb +2 -2
- data/lib/scrivito/backend/obj_data_cache.rb +22 -9
- data/lib/scrivito/basic_obj.rb +238 -130
- data/lib/scrivito/basic_widget.rb +32 -20
- data/lib/scrivito/binary.rb +74 -45
- data/lib/scrivito/binary_routing.rb +52 -0
- data/lib/scrivito/cache_middleware.rb +0 -5
- data/lib/scrivito/client_attribute_serializer.rb +134 -0
- data/lib/scrivito/cms_backend.rb +51 -33
- data/lib/scrivito/cms_data_cache.rb +1 -0
- data/lib/scrivito/cms_dispatch_controller.rb +1 -1
- data/lib/scrivito/cms_env.rb +1 -11
- data/lib/scrivito/cms_field_tag.rb +10 -7
- data/lib/scrivito/cms_rest_api/rate_limit.rb +5 -5
- data/lib/scrivito/cms_rest_api/request_timer.rb +27 -0
- data/lib/scrivito/cms_rest_api/widget_extractor.rb +8 -6
- data/lib/scrivito/cms_rest_api.rb +107 -54
- data/lib/scrivito/cms_routing.rb +13 -25
- data/lib/scrivito/configuration.rb +5 -2
- data/lib/scrivito/controller_actions.rb +68 -7
- data/lib/scrivito/controller_runtime.rb +8 -0
- data/lib/scrivito/date_attribute.rb +8 -0
- data/lib/scrivito/errors.rb +6 -3
- data/lib/scrivito/generator_helper.rb +13 -0
- data/lib/scrivito/image_tag.rb +24 -30
- data/lib/scrivito/layout_tags.rb +12 -6
- data/lib/scrivito/link.rb +46 -30
- data/lib/scrivito/log_subscriber.rb +15 -0
- data/lib/scrivito/membership.rb +3 -3
- data/lib/scrivito/membership_collection.rb +10 -10
- data/lib/scrivito/meta_data_collection.rb +22 -0
- data/lib/scrivito/model_library.rb +7 -1
- data/lib/scrivito/obj_collection.rb +18 -16
- data/lib/scrivito/obj_params_parser.rb +1 -1
- data/lib/scrivito/obj_search_enumerator.rb +35 -35
- data/lib/scrivito/page_config.rb +55 -0
- data/lib/scrivito/request_homepage.rb +23 -0
- data/lib/scrivito/routing_helper.rb +8 -8
- data/lib/scrivito/sdk_engine.rb +2 -3
- data/lib/scrivito/ui_config.rb +85 -0
- data/lib/scrivito/user.rb +30 -23
- data/lib/scrivito/user_definition.rb +48 -47
- data/lib/scrivito/widget_tag.rb +11 -0
- data/lib/scrivito/workspace.rb +93 -35
- data/lib/scrivito/workspace_selection_middleware.rb +8 -1
- data/lib/scrivito_sdk.rb +24 -24
- metadata +24 -33
- data/lib/assets/javascripts/scrivito_sdk.js +0 -57
- data/lib/assets/stylesheets/scrivito_sdk.css +0 -1
- data/lib/scrivito/client_config.rb +0 -113
- data/lib/scrivito/editing_context_helper.rb +0 -19
- data/lib/scrivito/named_link.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db9dbbb4e8e68455e0fe9b3bc987ac8034f36751
|
4
|
+
data.tar.gz: 05117844c6a7c272dd31645ee5cad9b374b5c661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d6ba62c8a1296eedd929af7246b95df7bdbb8b770e81eebef8f049378d35b8a9efcdb6899f1b8d92f3ee2e5bc6c85feb5998c286d532500eb9b8f9e9ecbbd204
|
7
|
+
data.tar.gz: c5cd61adaa67b40927297df9283b38b919629bc0914be07244bc2f9ebb6bc86d2feac2d78ea8925c801cd12fe9783b240468af440d464557c82d0645cc2e15ad
|
@@ -4,6 +4,11 @@ class BlobsController < WebserviceController
|
|
4
4
|
def upload_permission
|
5
5
|
@permission = CmsRestApi.task_unaware_request(:get, 'blobs/upload_permission')
|
6
6
|
end
|
7
|
+
|
8
|
+
def activate_upload
|
9
|
+
CmsRestApi.activate_upload(params.slice(:upload, :obj_id, :filename, :content_type))
|
10
|
+
render_empty_json
|
11
|
+
end
|
7
12
|
end
|
8
13
|
|
9
14
|
end
|
@@ -54,7 +54,8 @@ module Scrivito
|
|
54
54
|
|
55
55
|
def destroy
|
56
56
|
in_selected_workspace do
|
57
|
-
|
57
|
+
parent = current_obj.parent
|
58
|
+
@redirect_to = parent ? scrivito_path(parent) : scrivito_root_path
|
58
59
|
current_obj.destroy
|
59
60
|
end
|
60
61
|
end
|
@@ -2,13 +2,43 @@ module Scrivito
|
|
2
2
|
|
3
3
|
class UiController < ActionController::Base
|
4
4
|
def index
|
5
|
+
@application_src = application_src
|
6
|
+
if editing_context.editor
|
7
|
+
@ui_config = UiConfig.new(
|
8
|
+
editing_context: editing_context,
|
9
|
+
resource: resource,
|
10
|
+
return_to: params[:return_to],
|
11
|
+
app_extension_tags: app_extension_tags,
|
12
|
+
).to_json
|
13
|
+
else
|
14
|
+
redirect_to @application_src
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def application_src
|
21
|
+
return "/" if resource_details?
|
22
|
+
|
5
23
|
given_query = request.env['QUERY_STRING']
|
6
24
|
query = "?#{given_query}" if given_query.present?
|
7
|
-
|
8
|
-
redirect_to @application_src unless editing_context.editor
|
25
|
+
"/#{params['application_path']}#{query}"
|
9
26
|
end
|
10
27
|
|
11
|
-
|
28
|
+
def resource_details?
|
29
|
+
params[:resource_id].present?
|
30
|
+
end
|
31
|
+
|
32
|
+
def resource
|
33
|
+
if resource_details?
|
34
|
+
editing_context.selected_workspace.objs.find_including_deleted(params[:resource_id])
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def app_extension_tags
|
39
|
+
view_context.javascript_include_tag('scrivito_app_extensions') +
|
40
|
+
view_context.stylesheet_link_tag('scrivito_app_extensions')
|
41
|
+
end
|
12
42
|
|
13
43
|
def editing_context
|
14
44
|
EditingContextMiddleware.from_request(request)
|
@@ -122,6 +122,9 @@ module ScrivitoHelper
|
|
122
122
|
# @option editing_options [String] :placeholder ('/assets/scrivito/image_placeholder.png') URL
|
123
123
|
# or path to image to be displayed if target is missing
|
124
124
|
#
|
125
|
+
# @option editing_options [Hash] :transform if set, the displayed image will be transformed using
|
126
|
+
# the definition in the given hash, see {Scrivito::Binary#transform}.
|
127
|
+
#
|
125
128
|
# @example
|
126
129
|
# scrivito_image_tag(@obj, :my_linklist)
|
127
130
|
# scrivito_image_tag(@obj, :my_linklist, alt: 'Interesting picture', class: 'my_image')
|
@@ -140,6 +143,9 @@ module ScrivitoHelper
|
|
140
143
|
# @example Render an image tag for a binary Obj
|
141
144
|
# scrivito_image_tag(@image)
|
142
145
|
#
|
146
|
+
# @example Render an image tag with an on-the-fly calculated thumbnail
|
147
|
+
# scrivito_image_tag @obj, :my_binary, {}, transform: {width: 50, height: 50}
|
148
|
+
#
|
143
149
|
# @return [String] HTML image tag
|
144
150
|
#
|
145
151
|
# @raise [ScrivitoError] if +field_name+ is not set and Obj is not binary
|
@@ -356,7 +362,7 @@ module ScrivitoHelper
|
|
356
362
|
# @api public
|
357
363
|
#
|
358
364
|
def scrivito_body_tags
|
359
|
-
Scrivito::LayoutTags.new(self).
|
365
|
+
Scrivito::LayoutTags.new(self).page_config(@obj)
|
360
366
|
end
|
361
367
|
|
362
368
|
{
|
@@ -379,16 +385,11 @@ module ScrivitoHelper
|
|
379
385
|
end
|
380
386
|
end
|
381
387
|
|
382
|
-
#
|
383
|
-
# Returns the current user.
|
384
|
-
#
|
385
388
|
# @api public
|
386
|
-
# @return [Scrivito::User]
|
387
|
-
#
|
388
|
-
# @return +nil+ otherwise.
|
389
|
-
#
|
389
|
+
# @return [Scrivito::User, nil]
|
390
|
+
# See {Scrivito::ControllerActions#scrivito_user} for details.
|
390
391
|
def scrivito_user
|
391
|
-
Scrivito::
|
392
|
+
Scrivito::EditingContextMiddleware.from_request(request).editor
|
392
393
|
end
|
393
394
|
|
394
395
|
def inplace_editing_allowed?
|
@@ -398,15 +399,8 @@ module ScrivitoHelper
|
|
398
399
|
}
|
399
400
|
end
|
400
401
|
|
401
|
-
#
|
402
|
-
#
|
403
|
-
#
|
404
|
-
#
|
405
|
-
# @return +true+ if the current visitor is an authenticated editor, the selected workspace is
|
406
|
-
# editable and the display mode is +editing+.
|
407
|
-
# @return +false+ otherwise.
|
408
|
-
#
|
409
|
-
def scrivito_in_editable_view?
|
410
|
-
Scrivito::EditingContextHelper.new(request).in_editable_view?
|
411
|
-
end
|
402
|
+
# @!method scrivito_in_editable_view?
|
403
|
+
# @return [Boolean]
|
404
|
+
# See {Scrivito::ControllerActions#scrivito_in_editable_view?} for details.
|
405
|
+
# @api public
|
412
406
|
end
|
@@ -1 +1 @@
|
|
1
|
-
json.merge! current_obj
|
1
|
+
json.merge! Scrivito::ClientAttributeSerializer.serialize_obj(current_obj)
|
@@ -1,8 +1,9 @@
|
|
1
1
|
json.extract! workspace, :id, :title
|
2
|
+
json.is_accessible can_user_read_workspace?(workspace)
|
2
3
|
|
3
4
|
json.memberships workspace.memberships do |membership|
|
4
5
|
json.extract! membership, :user_id, :role
|
5
6
|
json.description membership.user.description
|
6
7
|
end
|
7
8
|
|
8
|
-
json.
|
9
|
+
json.outdated workspace.outdated?
|
data/config/ca-bundle.crt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
2
|
## Bundle of CA Root Certificates
|
3
3
|
##
|
4
|
-
## Certificate data from Mozilla as of: Wed
|
4
|
+
## Certificate data from Mozilla as of: Wed Sep 2 13:20:26 2015
|
5
5
|
##
|
6
6
|
## This is a bundle of X.509 certificates of public Certificate Authorities
|
7
7
|
## (CA). These were automatically extracted from Mozilla's root certificates
|
data/config/precedence_routes.rb
CHANGED
@@ -34,6 +34,8 @@ Scrivito::SdkEngine.routes.draw do
|
|
34
34
|
|
35
35
|
get '__scrivito/blobs/upload_permission' => 'scrivito/blobs#upload_permission',
|
36
36
|
defaults: {format: :json}
|
37
|
+
put '__scrivito/blobs/activate_upload' => 'scrivito/blobs#activate_upload',
|
38
|
+
defaults: {format: :json}
|
37
39
|
|
38
40
|
resources :workspaces,
|
39
41
|
controller: 'scrivito/workspaces',
|
@@ -53,8 +55,7 @@ Scrivito::SdkEngine.routes.draw do
|
|
53
55
|
get '__scrivito/render_widget/:id/widget_details/:widget_id' => 'scrivito/cms_dispatch#widget_details'
|
54
56
|
|
55
57
|
get '__scrivito/page_details/:id' => 'scrivito/cms_dispatch#page_details'
|
56
|
-
|
57
|
-
get '__scrivito/resource_details/:resource_id' => 'scrivito/cms_dispatch#resource_details'
|
58
|
+
get '__scrivito/resource_details/:resource_id', to: 'scrivito/ui#index'
|
58
59
|
|
59
60
|
get '__scrivito/to_binary' => 'scrivito/binary_redirect#to_binary', as: :binary
|
60
61
|
|
@@ -0,0 +1,46 @@
|
|
1
|
+
(function() {
|
2
|
+
if (window.parent !== window) {
|
3
|
+
var scrivito_ui = window.parent.scrivito;
|
4
|
+
if (scrivito_ui) {
|
5
|
+
// In an iframe and parent window contains the UI: in UI mode.
|
6
|
+
var cms_document = scrivito_ui.cms_element.from_dom_element(document);
|
7
|
+
cms_document.install_public_api();
|
8
|
+
cms_document.add_app_extensions();
|
9
|
+
|
10
|
+
// wait for app to be fully loaded
|
11
|
+
document.addEventListener("DOMContentLoaded", function() {
|
12
|
+
// wait for UI to be fully loaded
|
13
|
+
scrivito_ui.on("load", function() {
|
14
|
+
cms_document.assert_user_logged_in();
|
15
|
+
cms_document.connect();
|
16
|
+
});
|
17
|
+
});
|
18
|
+
}
|
19
|
+
} else {
|
20
|
+
document.addEventListener("DOMContentLoaded", function() {
|
21
|
+
// Not in UI mode, but editing is allowed: redirect to the UI mode.
|
22
|
+
if (document.querySelector('[data-scrivito-private-page-config]')) {
|
23
|
+
console.log('Scrivito config found: redirecting to the UI...');
|
24
|
+
window.location = '/scrivito' +
|
25
|
+
window.location.pathname +
|
26
|
+
window.location.search +
|
27
|
+
window.location.hash;
|
28
|
+
}
|
29
|
+
});
|
30
|
+
}
|
31
|
+
|
32
|
+
// If the SDK is completely missing, the custom callbacks should nevertheless run.
|
33
|
+
if (!window.scrivito) {
|
34
|
+
window.scrivito = {
|
35
|
+
on: function(event_name, callback) {
|
36
|
+
if (event_name === 'content') {
|
37
|
+
document.addEventListener("DOMContentLoaded", function() {
|
38
|
+
callback(window.document);
|
39
|
+
});
|
40
|
+
}
|
41
|
+
},
|
42
|
+
|
43
|
+
in_editable_view: function() { return false; }
|
44
|
+
};
|
45
|
+
}
|
46
|
+
}());
|