scrivito_sdk 0.40.0.rc1 → 0.40.0.rc2
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.
- checksums.yaml +4 -4
- data/README.md +14 -0
- data/app/views/scrivito/objs/search.json.jbuilder +1 -1
- data/app/views/scrivito/ui/index.html.erb +3 -2
- data/config/ca-bundle.crt +1 -1
- data/lib/assets/javascripts/scrivito_sdk.js +23 -7
- data/lib/assets/javascripts/scrivito_ui.js +58 -16
- data/lib/assets/stylesheets/scrivito_ui.css +2 -2
- data/lib/generators/scrivito/install/install_generator.rb +6 -5
- data/lib/generators/scrivito/install/templates/app/models/download.rb +5 -0
- data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb +4 -0
- data/lib/scrivito/content_conversion.rb +8 -3
- data/lib/scrivito/type_computer.rb +4 -4
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7498188dfcdfe0f66634fda2984b92bbf6385cfa
|
|
4
|
+
data.tar.gz: fe7358c377c964a4ca0e5f9240785ac2ab55b3c2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 691ab70b6dae7619714d36bbbfd82113b2f967f8bb5f410e685fff5d6d5de3cdeb9b1c35b9ef407c17a1a83ddb5de54a6e5fb46697307052b4cd3780f78304e4
|
|
7
|
+
data.tar.gz: adce3b4e426bd92db2057e60143a65b4b5953779d12f50a0cbcae67292bccde50f978771d42948df0581be1f77b9cd1b65e850d0c23aa738fe298f0f75c98dfc
|
data/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Scrivito SDK
|
|
2
|
+
|
|
3
|
+
[](http://badge.fury.io/rb/scrivito_sdk)
|
|
4
|
+
|
|
5
|
+
The Scrivito SDK makes CMS objects maintained by means of the cloud-based Scrivito CMS available
|
|
6
|
+
to your Rails application. It offers easy-to-use functionality for rendering CMS content, doing
|
|
7
|
+
searches, etc. For more information about Scrivito, please visit https://scrivito.com/.
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2009 - 2014 Infopark AG (http://www.infopark.com)
|
|
12
|
+
|
|
13
|
+
This software can be used and modified under the LGPL-3.0. Please refer to
|
|
14
|
+
http://www.gnu.org/licenses/lgpl-3.0.html for the license text.
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
<%= stylesheet_link_tag 'scrivito_ui_extensions' %>
|
|
8
8
|
<%= javascript_include_tag 'scrivito_ui_extensions' %>
|
|
9
9
|
</head>
|
|
10
|
-
<body>
|
|
11
|
-
<iframe name="scrivito_application" src="<%= @application_src %>">
|
|
10
|
+
<body id="scrivito_ui">
|
|
11
|
+
<iframe name="scrivito_application" src="<%= @application_src %>"></iframe>
|
|
12
|
+
<%= scrivito_body_tags %>
|
|
12
13
|
</body>
|
|
13
14
|
</html>
|
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: Fri Jan 23 00:31:10 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
|
|
@@ -2,29 +2,45 @@
|
|
|
2
2
|
if (window.parent !== window) {
|
|
3
3
|
var scrivito_ui = window.parent.scrivito;
|
|
4
4
|
if (scrivito_ui) {
|
|
5
|
+
// In an iframe and parent window contains the UI: in UI mode.
|
|
5
6
|
var cms_document = scrivito_ui.cms_element.from_dom_element($(document));
|
|
6
7
|
cms_document.install_public_api();
|
|
8
|
+
|
|
7
9
|
$(function() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
if (!
|
|
11
|
-
|
|
10
|
+
var dom_config = scrivito_ui.dom_config.read($('body'));
|
|
11
|
+
if (scrivito_ui.is_inited()) {
|
|
12
|
+
if (!dom_config) {
|
|
13
|
+
// UI is already running, but editing is not allowed: reload UI to make it disappear.
|
|
14
|
+
window.parent.location.reload();
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
if (!dom_config) {
|
|
18
|
+
// UI is not yet running and config is missing.
|
|
19
|
+
$.error('Missing Scrivito config. Did you forget to include scrivito_body_tags in layout?');
|
|
12
20
|
}
|
|
13
|
-
scrivito_ui.init(
|
|
21
|
+
scrivito_ui.init(dom_config);
|
|
14
22
|
scrivito_ui.gui.start();
|
|
23
|
+
if (window.parent.location.hash.length) {
|
|
24
|
+
location.hash = window.parent.location.hash;
|
|
25
|
+
}
|
|
15
26
|
}
|
|
16
27
|
cms_document.connect();
|
|
17
28
|
});
|
|
18
29
|
}
|
|
19
30
|
} else {
|
|
20
31
|
$(function() {
|
|
21
|
-
|
|
32
|
+
// Not in UI mode, but editing is allowed: redirect to the UI mode.
|
|
33
|
+
if ($('[data-scrivito-private-config]').length) {
|
|
22
34
|
console.log('Scrivito config found: redirecting to the UI...');
|
|
23
|
-
window.location = '/scrivito'+
|
|
35
|
+
window.location = '/scrivito' +
|
|
36
|
+
window.location.pathname +
|
|
37
|
+
window.location.search +
|
|
38
|
+
window.location.hash;
|
|
24
39
|
}
|
|
25
40
|
});
|
|
26
41
|
}
|
|
27
42
|
|
|
43
|
+
// If the SDK is completely missing, the custom callbacks should nevertheless run.
|
|
28
44
|
if (!window.scrivito) {
|
|
29
45
|
window.scrivito = {
|
|
30
46
|
on: function(event_name, callback) {
|
|
@@ -24398,6 +24398,7 @@ $.i18n().load({
|
|
|
24398
24398
|
'commands.revert_obj.dialog.confirm': 'Verwerfen',
|
|
24399
24399
|
|
|
24400
24400
|
'commands.revert_widget.title': 'Änderungen am Widget verwerfen',
|
|
24401
|
+
'commands.revert_widget.rtc_workspace': 'Dieses Widget ist Teil der "rtc"-Arbeitskopie, bei der Änderungen an Widgets nicht verworfen werden können.',
|
|
24401
24402
|
'commands.revert_widget.is_new': 'Dies ist ein neues Widget. Um die Erstellung dieses Widgets rückgängig zu machen, löschen Sie es bitte.',
|
|
24402
24403
|
'commands.revert_widget.is_not_modified': 'Dieses Widget wurde nicht geändert. Daher gibt es nichts zu verwerfen.',
|
|
24403
24404
|
'commands.revert_widget.dialog.title': 'Wirklich Änderungen an diesem Widget verwerfen?',
|
|
@@ -24612,6 +24613,7 @@ $.i18n().load({
|
|
|
24612
24613
|
'commands.revert_obj.dialog.confirm': 'Discard',
|
|
24613
24614
|
|
|
24614
24615
|
'commands.revert_widget.title': 'Discard changes to widget',
|
|
24616
|
+
'commands.revert_widget.rtc_workspace': 'This widget is part of the "rtc" working copy, for which discarding changes to a widgets is not supported.',
|
|
24615
24617
|
'commands.revert_widget.is_new': 'This is a new widget. To discard the creation of this widget, please delete it.',
|
|
24616
24618
|
'commands.revert_widget.is_not_modified': 'This widget has not been modified. Therefore, nothing can be discarded.',
|
|
24617
24619
|
'commands.revert_widget.dialog.title': 'Really discard changes to this widget?',
|
|
@@ -25120,7 +25122,7 @@ var scrivito = {};
|
|
|
25120
25122
|
var reload = function(dom_element) {
|
|
25121
25123
|
assert_valid_dom_element(dom_element);
|
|
25122
25124
|
build_cms_element(dom_element);
|
|
25123
|
-
dom_element.trigger('reload.scrivito');
|
|
25125
|
+
$(dom_element).trigger('reload.scrivito');
|
|
25124
25126
|
};
|
|
25125
25127
|
|
|
25126
25128
|
$.extend(scrivito, {
|
|
@@ -25166,13 +25168,18 @@ var scrivito = {};
|
|
|
25166
25168
|
}());
|
|
25167
25169
|
(function() {
|
|
25168
25170
|
_.extend(scrivito, {
|
|
25169
|
-
url_update: function(
|
|
25170
|
-
if (
|
|
25171
|
-
|
|
25172
|
-
|
|
25173
|
-
|
|
25174
|
-
|
|
25175
|
-
|
|
25171
|
+
url_update: function(application_cms_window, ui_cms_window) {
|
|
25172
|
+
if (application_cms_window === ui_cms_window) { return; }
|
|
25173
|
+
|
|
25174
|
+
application_cms_window.on('document', function(application_document) {
|
|
25175
|
+
var ui_window = ui_cms_window.browser_window();
|
|
25176
|
+
var application_window = application_document.browser_window();
|
|
25177
|
+
|
|
25178
|
+
var ui_url = ui_window.location.origin + '/scrivito' +
|
|
25179
|
+
application_window.location.pathname +
|
|
25180
|
+
application_window.location.search +
|
|
25181
|
+
application_window.location.hash;
|
|
25182
|
+
ui_window.history.replaceState({}, '', ui_url);
|
|
25176
25183
|
});
|
|
25177
25184
|
}
|
|
25178
25185
|
});
|
|
@@ -26435,7 +26442,7 @@ var scrivito = {};
|
|
|
26435
26442
|
// PUBLIC
|
|
26436
26443
|
_.extend(that, {
|
|
26437
26444
|
install_public_api: function() {
|
|
26438
|
-
local_
|
|
26445
|
+
local_$().fn.scrivito = scrivito.jquery_plugin;
|
|
26439
26446
|
|
|
26440
26447
|
browser_window.scrivito = _.extend({}, additional_public_api, {
|
|
26441
26448
|
on: local_on_function,
|
|
@@ -26486,7 +26493,7 @@ var scrivito = {};
|
|
|
26486
26493
|
|
|
26487
26494
|
// return the given dom element using the local jQuery lib or the lib itself.
|
|
26488
26495
|
local_jquery: function(element) {
|
|
26489
|
-
return element ? local_$(element) : local_
|
|
26496
|
+
return element ? local_$()(element) : local_$();
|
|
26490
26497
|
},
|
|
26491
26498
|
|
|
26492
26499
|
browser_window: function() {
|
|
@@ -26523,7 +26530,9 @@ var scrivito = {};
|
|
|
26523
26530
|
|
|
26524
26531
|
var browser_window = browser_document.defaultView;
|
|
26525
26532
|
|
|
26526
|
-
var local_$ =
|
|
26533
|
+
var local_$ = function() {
|
|
26534
|
+
return browser_window.jQuery;
|
|
26535
|
+
};
|
|
26527
26536
|
|
|
26528
26537
|
var connected = false;
|
|
26529
26538
|
var load_callbacks = [];
|
|
@@ -28398,9 +28407,7 @@ var scrivito = {};
|
|
|
28398
28407
|
scrivito.gui.on('document', function(cms_document) {
|
|
28399
28408
|
var body = cms_document.dom_element().find('body');
|
|
28400
28409
|
|
|
28401
|
-
body.on('reload.scrivito', function() {
|
|
28402
|
-
cms_document.window().reload();
|
|
28403
|
-
});
|
|
28410
|
+
$(body).on('reload.scrivito', function() { cms_document.window().reload(); });
|
|
28404
28411
|
|
|
28405
28412
|
// TODO: remove this in 1.0.0.
|
|
28406
28413
|
cms_document.local_jquery(body).on('scrivito_reload', function() {
|
|
@@ -29373,6 +29380,9 @@ var scrivito = {};
|
|
|
29373
29380
|
},
|
|
29374
29381
|
|
|
29375
29382
|
disabled: function() {
|
|
29383
|
+
if (scrivito.editing_context.selected_workspace.is_rtc()) {
|
|
29384
|
+
return scrivito.t('commands.revert_widget.rtc_workspace');
|
|
29385
|
+
}
|
|
29376
29386
|
if (widget.is_new()) {
|
|
29377
29387
|
return scrivito.i18n.translate('commands.revert_widget.is_new');
|
|
29378
29388
|
}
|
|
@@ -29828,12 +29838,16 @@ var scrivito = {};
|
|
|
29828
29838
|
return false;
|
|
29829
29839
|
};
|
|
29830
29840
|
|
|
29831
|
-
jquery_object.on('reload.scrivito', function() {
|
|
29841
|
+
$(jquery_object).on('reload.scrivito', function() {
|
|
29842
|
+
activate();
|
|
29843
|
+
return false;
|
|
29844
|
+
});
|
|
29832
29845
|
|
|
29833
29846
|
// TODO: remove this in 1.0.0.
|
|
29834
29847
|
scrivito.cms_document.local_jquery(jquery_object).on('scrivito_reload', function() {
|
|
29835
29848
|
scrivito.deprecation_warning('$.trigger("scrivito_reload")', '$.scrivito("reload")');
|
|
29836
29849
|
activate();
|
|
29850
|
+
return false;
|
|
29837
29851
|
});
|
|
29838
29852
|
};
|
|
29839
29853
|
}());
|
|
@@ -30393,6 +30407,34 @@ var scrivito = {};
|
|
|
30393
30407
|
|
|
30394
30408
|
(function() {
|
|
30395
30409
|
$(function() {
|
|
30396
|
-
|
|
30410
|
+
var iframe = $('iframe[name=scrivito_application]');
|
|
30411
|
+
scrivito.application_window = scrivito.cms_window.from(iframe);
|
|
30412
|
+
|
|
30413
|
+
// Fallback behavior in case that application window renders a page with no SDK, e.g. an error
|
|
30414
|
+
// or a static page.
|
|
30415
|
+
iframe.on('load', function() {
|
|
30416
|
+
var has_config = !!scrivito.application_document().dom_element()
|
|
30417
|
+
.find('[data-scrivito-private-config]').length;
|
|
30418
|
+
var has_sdk = !!scrivito.application_window.browser_window().scrivito;
|
|
30419
|
+
|
|
30420
|
+
// The application window is completely missing the SDK and the config.
|
|
30421
|
+
if (!has_config && !has_sdk) {
|
|
30422
|
+
// Install jQuery in order to allow correct application document bootstrapping.
|
|
30423
|
+
var browser_window = scrivito.application_window.browser_window();
|
|
30424
|
+
if (!browser_window.jQuery) { browser_window.jQuery = jQuery; }
|
|
30425
|
+
if (!browser_window.$) { browser_window.$ = $; }
|
|
30426
|
+
|
|
30427
|
+
// Bootstrap the application document.
|
|
30428
|
+
var application_document = scrivito.application_document();
|
|
30429
|
+
application_document.install_public_api();
|
|
30430
|
+
if (!scrivito.is_inited()) {
|
|
30431
|
+
// Start the UI if it is the first open, which responds with an error.
|
|
30432
|
+
// Use the fallback config with no page context.
|
|
30433
|
+
scrivito.init(scrivito.dom_config.read($('body')));
|
|
30434
|
+
scrivito.gui.start();
|
|
30435
|
+
}
|
|
30436
|
+
application_document.connect();
|
|
30437
|
+
}
|
|
30438
|
+
});
|
|
30397
30439
|
});
|
|
30398
30440
|
}());
|
|
@@ -3144,5 +3144,5 @@ html[dir="rtl"] .select2-container-multi .select2-search-choice-close {
|
|
|
3144
3144
|
*/
|
|
3145
3145
|
|
|
3146
3146
|
|
|
3147
|
-
body { overflow: hidden }
|
|
3148
|
-
iframe[name=scrivito_application] { border: 0px; width: 100%; height: 100%; position: absolute; top:
|
|
3147
|
+
body { overflow: hidden; position: fixed; margin: 0px; top: 45px; left: 0px; right: 0px; bottom: 0px; }
|
|
3148
|
+
iframe[name=scrivito_application] { border: 0px; width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; }
|
|
@@ -31,7 +31,7 @@ module Scrivito
|
|
|
31
31
|
File.join(Scrivito::Configuration.migration_path, 'install_scrivito_migration.rb')
|
|
32
32
|
end
|
|
33
33
|
|
|
34
|
-
def
|
|
34
|
+
def copy_page_files
|
|
35
35
|
copy_file 'app/models/page.rb'
|
|
36
36
|
copy_file 'app/controllers/page_controller.rb'
|
|
37
37
|
copy_file 'app/views/page/details.html.erb'
|
|
@@ -39,23 +39,24 @@ module Scrivito
|
|
|
39
39
|
copy_file 'app/views/page/thumbnail.html.erb'
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
-
def
|
|
42
|
+
def copy_resource_files
|
|
43
43
|
copy_file 'app/models/image.rb'
|
|
44
|
+
copy_file 'app/models/download.rb'
|
|
44
45
|
end
|
|
45
46
|
|
|
46
|
-
def
|
|
47
|
+
def copy_headline_widget_files
|
|
47
48
|
copy_file 'app/models/headline_widget.rb'
|
|
48
49
|
copy_file 'app/views/headline_widget/show.html.erb'
|
|
49
50
|
copy_file 'app/views/headline_widget/thumbnail.html.erb'
|
|
50
51
|
end
|
|
51
52
|
|
|
52
|
-
def
|
|
53
|
+
def copy_text_widget_files
|
|
53
54
|
copy_file 'app/models/text_widget.rb'
|
|
54
55
|
copy_file 'app/views/text_widget/show.html.erb'
|
|
55
56
|
copy_file 'app/views/text_widget/thumbnail.html.erb'
|
|
56
57
|
end
|
|
57
58
|
|
|
58
|
-
def
|
|
59
|
+
def copy_image_widget_files
|
|
59
60
|
copy_file 'app/models/image_widget.rb'
|
|
60
61
|
copy_file 'app/views/image_widget/show.html.erb'
|
|
61
62
|
copy_file 'app/views/image_widget/thumbnail.html.erb'
|
data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb
CHANGED
|
@@ -22,6 +22,10 @@ class InstallScrivitoMigration < Scrivito::Migration
|
|
|
22
22
|
{name: 'image', type: 'reference'}
|
|
23
23
|
])
|
|
24
24
|
|
|
25
|
+
Scrivito::ObjClass.create(name: 'Download', attributes:[
|
|
26
|
+
{name: 'blob', type: 'binary'},
|
|
27
|
+
])
|
|
28
|
+
|
|
25
29
|
Page.create(_path: '/', title: 'Welcome to Scrivito!', body: [
|
|
26
30
|
HeadlineWidget.new(headline: 'A professional Cloud CMS built for Ruby on Rails.'),
|
|
27
31
|
TextWidget.new(text: %{
|
|
@@ -33,14 +33,19 @@ module Scrivito
|
|
|
33
33
|
end
|
|
34
34
|
|
|
35
35
|
def self.convert_link(link_data, request_host, request_port)
|
|
36
|
-
|
|
36
|
+
return unless link_data
|
|
37
|
+
|
|
38
|
+
if url = link_data.delete(:url)
|
|
37
39
|
link_data.delete(:obj_id)
|
|
38
|
-
url = link_data.delete(:url)
|
|
39
40
|
link = Link.parse(url, request_host, request_port)
|
|
40
41
|
link_data.merge!(link.to_cms_api_linklist_params)
|
|
41
42
|
end
|
|
42
43
|
|
|
43
|
-
link_data
|
|
44
|
+
if obj_id = link_data.delete(:obj_id)
|
|
45
|
+
link_data.merge!(obj: Obj.find(obj_id))
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Link.new(link_data)
|
|
44
49
|
end
|
|
45
50
|
end
|
|
46
51
|
|
|
@@ -5,8 +5,8 @@ class TypeComputer
|
|
|
5
5
|
@base_class, @fallback_class = base_class, fallback_class
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
-
def compute_type(
|
|
9
|
-
load_class(
|
|
8
|
+
def compute_type(obj_class_name)
|
|
9
|
+
load_class(obj_class_name) || @fallback_class
|
|
10
10
|
end
|
|
11
11
|
|
|
12
12
|
def special_class?(klass)
|
|
@@ -15,8 +15,8 @@ class TypeComputer
|
|
|
15
15
|
|
|
16
16
|
private
|
|
17
17
|
|
|
18
|
-
def load_class(
|
|
19
|
-
klass =
|
|
18
|
+
def load_class(obj_class_name)
|
|
19
|
+
klass = obj_class_name.constantize
|
|
20
20
|
klass if inherits_from_base?(klass)
|
|
21
21
|
rescue NameError
|
|
22
22
|
end
|
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.40.0.rc2
|
|
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-
|
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: addressable
|
|
@@ -157,6 +157,7 @@ extensions: []
|
|
|
157
157
|
extra_rdoc_files: []
|
|
158
158
|
files:
|
|
159
159
|
- .yardopts
|
|
160
|
+
- README.md
|
|
160
161
|
- app/controllers/scrivito/blobs_controller.rb
|
|
161
162
|
- app/controllers/scrivito/default_cms_controller.rb
|
|
162
163
|
- app/controllers/scrivito/objs_controller.rb
|
|
@@ -210,6 +211,7 @@ files:
|
|
|
210
211
|
- lib/generators/scrivito/install/install_generator.rb
|
|
211
212
|
- lib/generators/scrivito/install/templates/app/controllers/cms_controller.rb
|
|
212
213
|
- lib/generators/scrivito/install/templates/app/controllers/page_controller.rb
|
|
214
|
+
- lib/generators/scrivito/install/templates/app/models/download.rb
|
|
213
215
|
- lib/generators/scrivito/install/templates/app/models/headline_widget.rb
|
|
214
216
|
- lib/generators/scrivito/install/templates/app/models/image.rb
|
|
215
217
|
- lib/generators/scrivito/install/templates/app/models/image_widget.rb
|