scrivito_sdk 1.8.1 → 1.9.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/binary_redirect_controller.rb +0 -1
- data/app/controllers/scrivito/obj_class_controller.rb +18 -0
- data/app/controllers/scrivito/objs_controller.rb +6 -6
- data/app/controllers/scrivito/workspaces_controller.rb +2 -18
- data/app/views/scrivito/obj_class/thumbnails.json.jbuilder +1 -0
- data/app/views/scrivito/objs/valid_page_classes.json.jbuilder +1 -0
- data/config/ca-bundle.crt +1 -1
- data/config/precedence_routes.rb +7 -12
- data/lib/assets/javascripts/scrivito.js +101 -10
- data/lib/assets/javascripts/scrivito_ui_redirect.js +85 -6
- data/lib/assets/javascripts/scrivito_with_js_sdk.js +22205 -18338
- data/lib/assets/stylesheets/scrivito.css +1 -1
- data/lib/generators/scrivito/install/templates/app/models/image.rb +0 -5
- data/lib/scrivito/attribute_content.rb +5 -4
- data/lib/scrivito/base_widget_tag.rb +1 -0
- data/lib/scrivito/basic_obj.rb +21 -41
- data/lib/scrivito/basic_widget.rb +1 -21
- data/lib/scrivito/binary.rb +0 -7
- data/lib/scrivito/binary_routing.rb +5 -6
- data/lib/scrivito/child_list_tag.rb +8 -1
- data/lib/scrivito/cms_env.rb +6 -2
- data/lib/scrivito/cms_field_tag.rb +2 -0
- data/lib/scrivito/cms_routing.rb +25 -13
- data/lib/scrivito/configuration.rb +1 -4
- data/lib/scrivito/disable_browser_cache_for_ui_middleware.rb +19 -0
- data/lib/scrivito/editing_context.rb +4 -0
- data/lib/scrivito/editing_context_middleware.rb +5 -1
- data/lib/scrivito/obj_collection.rb +4 -0
- data/lib/scrivito/page_config.rb +1 -1
- data/lib/scrivito/preset_routes.rb +1 -1
- data/lib/scrivito/revision.rb +1 -1
- data/lib/scrivito/sdk_engine.rb +1 -0
- data/lib/scrivito/ui_config.rb +6 -42
- data/lib/scrivito/ui_obj_classes_json_formatter.rb +48 -0
- data/lib/scrivito/user.rb +3 -0
- data/lib/scrivito/user_definition.rb +1 -1
- data/lib/scrivito/workspace.rb +1 -1
- metadata +8 -10
- data/app/controllers/scrivito/completion_controller.rb +0 -12
- data/app/views/scrivito/completion/suggest.json.jbuilder +0 -1
- data/app/views/scrivito/objs/show.json.jbuilder +0 -2
- data/app/views/scrivito/webservice/workspaces.json.jbuilder +0 -1
- data/app/views/scrivito/workspaces/show.json.jbuilder +0 -1
- data/lib/assets/images/scrivito/source_type_invalid.png +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60da14f778503ff46b57442122d47bf01a721fde
|
4
|
+
data.tar.gz: aee9948d8644eef7ad7224bc914bdc4b86e01341
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5874c1ee568d39901dd0e24e2aa55fd78cc262cda2405e04b30fbcdd97c3d21585cf87b60a0ad0899c7cc8288589195d6c12d67f80ff81f62eaa5dba6e68d50b
|
7
|
+
data.tar.gz: ab11365620561c6b00ca1ff3764adb6a25f14694e59a339c13293775d057bffdc5f69958e09cd5ccaaff2afae500ed9c196d6c44a48a13a30bea36a2570dcc92
|
@@ -7,7 +7,6 @@ module Scrivito
|
|
7
7
|
head :precondition_failed
|
8
8
|
rescue TransformationSourceError => error
|
9
9
|
case error.code
|
10
|
-
when /transform.source.type_invalid/ then render_error('source_type_invalid')
|
11
10
|
when /transform.source.too_large/ then render_error('source_too_large')
|
12
11
|
else render_error('source_invalid')
|
13
12
|
end
|
@@ -10,6 +10,13 @@ module Scrivito
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
+
def thumbnails
|
14
|
+
model_classes = [*Scrivito.models.objs, *Scrivito.models.widgets]
|
15
|
+
@thumbnails = model_classes.each_with_object({}) do |model_class, hash|
|
16
|
+
hash[model_class.name] = build_selection_option(model_class.name)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
13
20
|
private
|
14
21
|
|
15
22
|
def compute_defaults_for(obj_class)
|
@@ -78,5 +85,16 @@ module Scrivito
|
|
78
85
|
def obj_params_parser
|
79
86
|
ObjCreateParamsParser.new(request.host, request.port)
|
80
87
|
end
|
88
|
+
|
89
|
+
def build_selection_option(class_name)
|
90
|
+
template_path = "#{class_name.underscore}/thumbnail"
|
91
|
+
|
92
|
+
begin
|
93
|
+
render_to_string(template_path, layout: false, formats: :html)
|
94
|
+
rescue ActionView::MissingTemplate
|
95
|
+
render_to_string('scrivito/fallback_thumbnail', layout: false, formats: :html,
|
96
|
+
locals: {class_name: class_name, template_path: template_path})
|
97
|
+
end
|
98
|
+
end
|
81
99
|
end
|
82
100
|
end
|
@@ -5,10 +5,6 @@ module Scrivito
|
|
5
5
|
:widget_class_selection,
|
6
6
|
]
|
7
7
|
|
8
|
-
def show
|
9
|
-
in_selected_workspace { render }
|
10
|
-
end
|
11
|
-
|
12
8
|
def widget
|
13
9
|
in_selected_workspace { render }
|
14
10
|
end
|
@@ -19,11 +15,15 @@ module Scrivito
|
|
19
15
|
end
|
20
16
|
|
21
17
|
def page_class_selection
|
22
|
-
@page_class_markup =
|
18
|
+
@page_class_markup = collect_valid_page_classes.map do |page_class_name|
|
23
19
|
build_selection_option(page_class_name)
|
24
20
|
end
|
25
21
|
end
|
26
22
|
|
23
|
+
def valid_page_classes
|
24
|
+
@valid_page_class_names = collect_valid_page_classes
|
25
|
+
end
|
26
|
+
|
27
27
|
def widget_class_selection
|
28
28
|
load_obj
|
29
29
|
|
@@ -109,7 +109,7 @@ module Scrivito
|
|
109
109
|
{name: class_name, markup: markup}
|
110
110
|
end
|
111
111
|
|
112
|
-
def
|
112
|
+
def collect_valid_page_classes
|
113
113
|
without_hidden_classes(page_classes_from_obj).map(&:to_s)
|
114
114
|
end
|
115
115
|
|
@@ -1,22 +1,7 @@
|
|
1
1
|
module Scrivito
|
2
2
|
class WorkspacesController < WebserviceController
|
3
|
-
|
4
|
-
|
5
|
-
subject = params.key?(:id) ? current_workspace : :workspace
|
6
|
-
authorize_workspace_access(require_permission, subject, &block)
|
7
|
-
end
|
8
|
-
end
|
9
|
-
|
10
|
-
restrict_access_to :show, require_permission: :read
|
11
|
-
restrict_access_to :check, require_permission: :publish
|
12
|
-
restrict_access_to :publish_approval, require_permission: :publish
|
13
|
-
|
14
|
-
def index
|
15
|
-
@workspaces = Workspace.all.select(&method(:can_user_read_workspace?))
|
16
|
-
render :workspaces
|
17
|
-
end
|
18
|
-
|
19
|
-
def show
|
3
|
+
around_action only: [:check, :publish_approval] do |_, block|
|
4
|
+
authorize_workspace_access(:publish, current_workspace, &block)
|
20
5
|
end
|
21
6
|
|
22
7
|
def check
|
@@ -49,7 +34,6 @@ module Scrivito
|
|
49
34
|
def current_workspace
|
50
35
|
@current_workspace ||= Workspace.find(params[:id])
|
51
36
|
end
|
52
|
-
helper_method :current_workspace
|
53
37
|
|
54
38
|
def certificates_param
|
55
39
|
assert_valid_certificates_param
|
@@ -0,0 +1 @@
|
|
1
|
+
json.merge! @thumbnails
|
@@ -0,0 +1 @@
|
|
1
|
+
json.merge! @valid_page_class_names
|
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:
|
4
|
+
## Certificate data from Mozilla as of: Wed Mar 29 12:18:58 2017 GMT
|
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
@@ -9,9 +9,10 @@ Scrivito::SdkEngine.routes.draw do
|
|
9
9
|
scope '__scrivito', module: 'scrivito' do
|
10
10
|
get ':id', to: 'cms_dispatch#index', as: :base_id, constraints: {id: /\h{16}/}
|
11
11
|
|
12
|
-
resources :objs, controller: 'objs', only: [
|
12
|
+
resources :objs, controller: 'objs', only: [], defaults: {format: :json} do
|
13
13
|
collection do
|
14
14
|
get :page_class_selection
|
15
|
+
get :valid_page_classes
|
15
16
|
get :search
|
16
17
|
end
|
17
18
|
|
@@ -25,17 +26,13 @@ Scrivito::SdkEngine.routes.draw do
|
|
25
26
|
resources :sessions, controller: 'sessions', only: [:update], defaults: {format: :json}
|
26
27
|
|
27
28
|
get 'obj_class/:obj_class_name/defaults', to: 'obj_class#defaults'
|
29
|
+
get 'obj_class/thumbnails', to: 'obj_class#thumbnails'
|
30
|
+
|
28
31
|
put 'resolve_paths' => 'resolve_paths#resolve', defaults: {format: :json}
|
29
32
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
defaults: {format: :json} do
|
34
|
-
member do
|
35
|
-
put :publish_approval
|
36
|
-
get :check
|
37
|
-
end
|
38
|
-
end
|
33
|
+
get 'workspaces/:id/check', to: 'workspaces#check', defaults: {format: :json}
|
34
|
+
put 'workspaces/:id/publish_approval',
|
35
|
+
to: 'workspaces#publish_approval', defaults: {format: :json}
|
39
36
|
|
40
37
|
put 'users/mget' => 'users#mget', defaults: {format: :json}
|
41
38
|
get 'users/suggest' => 'users#suggest', defaults: {format: :json}
|
@@ -43,8 +40,6 @@ Scrivito::SdkEngine.routes.draw do
|
|
43
40
|
put 'ui_configs/mget' => 'ui_configs#mget', defaults: {format: :json}
|
44
41
|
put 'publish_abilities/mget' => 'publish_abilities#mget', defaults: {format: :json}
|
45
42
|
|
46
|
-
get 'suggest_completion' => 'completion#suggest', defaults: {format: :json}
|
47
|
-
|
48
43
|
get 'render_widget/:id/show_widget/:widget_id' => 'cms_dispatch#show_widget'
|
49
44
|
get 'render_widget/:id/widget_details/:widget_id' => 'cms_dispatch#widget_details'
|
50
45
|
|
@@ -1,7 +1,91 @@
|
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ i: moduleId,
|
15
|
+
/******/ l: false,
|
16
|
+
/******/ exports: {}
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.l = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // identity function for calling harmony imports with the correct context
|
37
|
+
/******/ __webpack_require__.i = function(value) { return value; };
|
38
|
+
|
39
|
+
/******/ // define getter function for harmony exports
|
40
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
41
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
42
|
+
/******/ Object.defineProperty(exports, name, {
|
43
|
+
/******/ configurable: false,
|
44
|
+
/******/ enumerable: true,
|
45
|
+
/******/ get: getter
|
46
|
+
/******/ });
|
47
|
+
/******/ }
|
48
|
+
/******/ };
|
49
|
+
|
50
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
51
|
+
/******/ __webpack_require__.n = function(module) {
|
52
|
+
/******/ var getter = module && module.__esModule ?
|
53
|
+
/******/ function getDefault() { return module['default']; } :
|
54
|
+
/******/ function getModuleExports() { return module; };
|
55
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
56
|
+
/******/ return getter;
|
57
|
+
/******/ };
|
58
|
+
|
59
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
60
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
61
|
+
|
62
|
+
/******/ // __webpack_public_path__
|
63
|
+
/******/ __webpack_require__.p = "";
|
64
|
+
|
65
|
+
/******/ // Load entry module and return exports
|
66
|
+
/******/ return __webpack_require__(__webpack_require__.s = 129);
|
67
|
+
/******/ })
|
68
|
+
/************************************************************************/
|
69
|
+
/******/ ({
|
70
|
+
|
71
|
+
/***/ 129:
|
72
|
+
/***/ (function(module, exports, __webpack_require__) {
|
73
|
+
|
1
74
|
"use strict";
|
2
75
|
|
76
|
+
|
77
|
+
__webpack_require__(2);
|
78
|
+
|
79
|
+
/***/ }),
|
80
|
+
|
81
|
+
/***/ 2:
|
82
|
+
/***/ (function(module, exports, __webpack_require__) {
|
83
|
+
|
84
|
+
"use strict";
|
85
|
+
|
86
|
+
|
3
87
|
(function () {
|
4
|
-
var scrivitoUi =
|
88
|
+
var scrivitoUi = void 0;
|
5
89
|
|
6
90
|
if (window.parent !== window) {
|
7
91
|
scrivitoUi = window.parent.scrivito;
|
@@ -9,13 +93,17 @@
|
|
9
93
|
// In an iframe and parent window contains the UI: in UI mode.
|
10
94
|
var cmsDocument = scrivitoUi.cms_element.from_dom_element(document);
|
11
95
|
cmsDocument.installPublicApi();
|
12
|
-
cmsDocument.
|
96
|
+
cmsDocument.addAppExtensions();
|
97
|
+
|
98
|
+
if (window.scrivito.AppAdapter) {
|
99
|
+
cmsDocument.setAppAdapter(window.scrivito.AppAdapter);
|
100
|
+
}
|
13
101
|
|
14
102
|
// wait for app to be fully loaded
|
15
|
-
document.addEventListener(
|
103
|
+
document.addEventListener('DOMContentLoaded', function () {
|
16
104
|
// wait for UI to be fully loaded
|
17
|
-
scrivitoUi.on(
|
18
|
-
cmsDocument.
|
105
|
+
scrivitoUi.on('load', function () {
|
106
|
+
cmsDocument.assertUserLoggedIn();
|
19
107
|
cmsDocument.connect();
|
20
108
|
});
|
21
109
|
});
|
@@ -23,7 +111,10 @@
|
|
23
111
|
}
|
24
112
|
|
25
113
|
if (window.scrivito && window.scrivito.client) {
|
26
|
-
scrivito.client.
|
114
|
+
scrivito.client.init({ scrivitoUi: scrivitoUi, realmContext: window.scrivito });
|
115
|
+
document.addEventListener('DOMContentLoaded', function () {
|
116
|
+
return scrivito.BrowserLocation.init();
|
117
|
+
});
|
27
118
|
}
|
28
119
|
|
29
120
|
// If the SDK is completely missing, the custom callbacks should nevertheless run.
|
@@ -34,7 +125,7 @@
|
|
34
125
|
if (!window.scrivito.on) {
|
35
126
|
window.scrivito.on = function (eventName, callback) {
|
36
127
|
if (eventName === 'content') {
|
37
|
-
document.addEventListener(
|
128
|
+
document.addEventListener('DOMContentLoaded', function () {
|
38
129
|
return callback(window.document);
|
39
130
|
});
|
40
131
|
}
|
@@ -47,7 +138,7 @@
|
|
47
138
|
};
|
48
139
|
}
|
49
140
|
})();
|
50
|
-
// this is an asset pipeline manifest file that the rails developer includes
|
51
|
-
// in order to use Scrivito. this manifest does _not_ include the JS SDK.
|
52
|
-
//
|
53
141
|
|
142
|
+
/***/ })
|
143
|
+
|
144
|
+
/******/ });
|
@@ -1,10 +1,89 @@
|
|
1
|
-
(function() {
|
1
|
+
/******/ (function(modules) { // webpackBootstrap
|
2
|
+
/******/ // The module cache
|
3
|
+
/******/ var installedModules = {};
|
4
|
+
|
5
|
+
/******/ // The require function
|
6
|
+
/******/ function __webpack_require__(moduleId) {
|
7
|
+
|
8
|
+
/******/ // Check if module is in cache
|
9
|
+
/******/ if(installedModules[moduleId])
|
10
|
+
/******/ return installedModules[moduleId].exports;
|
11
|
+
|
12
|
+
/******/ // Create a new module (and put it into the cache)
|
13
|
+
/******/ var module = installedModules[moduleId] = {
|
14
|
+
/******/ i: moduleId,
|
15
|
+
/******/ l: false,
|
16
|
+
/******/ exports: {}
|
17
|
+
/******/ };
|
18
|
+
|
19
|
+
/******/ // Execute the module function
|
20
|
+
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
21
|
+
|
22
|
+
/******/ // Flag the module as loaded
|
23
|
+
/******/ module.l = true;
|
24
|
+
|
25
|
+
/******/ // Return the exports of the module
|
26
|
+
/******/ return module.exports;
|
27
|
+
/******/ }
|
28
|
+
|
29
|
+
|
30
|
+
/******/ // expose the modules object (__webpack_modules__)
|
31
|
+
/******/ __webpack_require__.m = modules;
|
32
|
+
|
33
|
+
/******/ // expose the module cache
|
34
|
+
/******/ __webpack_require__.c = installedModules;
|
35
|
+
|
36
|
+
/******/ // identity function for calling harmony imports with the correct context
|
37
|
+
/******/ __webpack_require__.i = function(value) { return value; };
|
38
|
+
|
39
|
+
/******/ // define getter function for harmony exports
|
40
|
+
/******/ __webpack_require__.d = function(exports, name, getter) {
|
41
|
+
/******/ if(!__webpack_require__.o(exports, name)) {
|
42
|
+
/******/ Object.defineProperty(exports, name, {
|
43
|
+
/******/ configurable: false,
|
44
|
+
/******/ enumerable: true,
|
45
|
+
/******/ get: getter
|
46
|
+
/******/ });
|
47
|
+
/******/ }
|
48
|
+
/******/ };
|
49
|
+
|
50
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
51
|
+
/******/ __webpack_require__.n = function(module) {
|
52
|
+
/******/ var getter = module && module.__esModule ?
|
53
|
+
/******/ function getDefault() { return module['default']; } :
|
54
|
+
/******/ function getModuleExports() { return module; };
|
55
|
+
/******/ __webpack_require__.d(getter, 'a', getter);
|
56
|
+
/******/ return getter;
|
57
|
+
/******/ };
|
58
|
+
|
59
|
+
/******/ // Object.prototype.hasOwnProperty.call
|
60
|
+
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
61
|
+
|
62
|
+
/******/ // __webpack_public_path__
|
63
|
+
/******/ __webpack_require__.p = "";
|
64
|
+
|
65
|
+
/******/ // Load entry module and return exports
|
66
|
+
/******/ return __webpack_require__(__webpack_require__.s = 130);
|
67
|
+
/******/ })
|
68
|
+
/************************************************************************/
|
69
|
+
/******/ ({
|
70
|
+
|
71
|
+
/***/ 130:
|
72
|
+
/***/ (function(module, exports, __webpack_require__) {
|
73
|
+
|
74
|
+
"use strict";
|
75
|
+
|
76
|
+
|
77
|
+
(function () {
|
2
78
|
if (window.parent === window) {
|
3
79
|
document.open();
|
4
80
|
document.close();
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
window.location.hash;
|
81
|
+
|
82
|
+
var location = window.location;
|
83
|
+
window.location = "/scrivito" + location.pathname + location.search + location.hash;
|
9
84
|
}
|
10
|
-
}()
|
85
|
+
})();
|
86
|
+
|
87
|
+
/***/ })
|
88
|
+
|
89
|
+
/******/ });
|