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.
- 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
@@ -23777,9 +23777,9 @@ function program5(depth0,data) {
|
|
23777
23777
|
return escapeExpression(stack1);
|
23778
23778
|
}
|
23779
23779
|
|
23780
|
-
buffer += "<li class=\"scrivito_menu_item
|
23781
|
-
if (stack1 = helpers.
|
23782
|
-
else { stack1 = depth0.
|
23780
|
+
buffer += "<li class=\"scrivito_menu_item ";
|
23781
|
+
if (stack1 = helpers.dom_id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
23782
|
+
else { stack1 = depth0.dom_id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
23783
23783
|
buffer += escapeExpression(stack1)
|
23784
23784
|
+ " ";
|
23785
23785
|
stack1 = helpers['if'].call(depth0, depth0.is_disabled, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
@@ -23787,11 +23787,10 @@ function program5(depth0,data) {
|
|
23787
23787
|
buffer += "\">\n <span title=\"";
|
23788
23788
|
stack1 = helpers['if'].call(depth0, depth0.is_enabled, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
|
23789
23789
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
23790
|
-
buffer += "\">\n
|
23790
|
+
buffer += "\">\n ";
|
23791
23791
|
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
23792
23792
|
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
23793
23793
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
23794
|
-
buffer += "</i>";
|
23795
23794
|
if (stack1 = helpers.title) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
23796
23795
|
else { stack1 = depth0.title; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
23797
23796
|
buffer += escapeExpression(stack1)
|
@@ -23800,6 +23799,40 @@ function program5(depth0,data) {
|
|
23800
23799
|
});
|
23801
23800
|
return this.ScrivitoHandlebarsTemplates["menu_item"];
|
23802
23801
|
}).call(this);
|
23802
|
+
(function() {
|
23803
|
+
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
23804
|
+
this.ScrivitoHandlebarsTemplates["menu_item/customer_icon"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
23805
|
+
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
23806
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
23807
|
+
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression;
|
23808
|
+
|
23809
|
+
|
23810
|
+
buffer += "<i class=\"scrivito_customer_icon sci_";
|
23811
|
+
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
23812
|
+
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
23813
|
+
buffer += escapeExpression(stack1)
|
23814
|
+
+ "\"></i>\n";
|
23815
|
+
return buffer;
|
23816
|
+
});
|
23817
|
+
return this.ScrivitoHandlebarsTemplates["menu_item/customer_icon"];
|
23818
|
+
}).call(this);
|
23819
|
+
(function() {
|
23820
|
+
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
23821
|
+
this.ScrivitoHandlebarsTemplates["menu_item/factory_icon"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
23822
|
+
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
23823
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
23824
|
+
var buffer = "", stack1, functionType="function";
|
23825
|
+
|
23826
|
+
|
23827
|
+
buffer += "<i class=\"scrivito_icon\">";
|
23828
|
+
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
23829
|
+
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
23830
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
23831
|
+
buffer += "</i>\n";
|
23832
|
+
return buffer;
|
23833
|
+
});
|
23834
|
+
return this.ScrivitoHandlebarsTemplates["menu_item/factory_icon"];
|
23835
|
+
}).call(this);
|
23803
23836
|
(function() {
|
23804
23837
|
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
23805
23838
|
this.ScrivitoHandlebarsTemplates["menu_item/spinner"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
@@ -24170,11 +24203,15 @@ function program7(depth0,data) {
|
|
24170
24203
|
return escapeExpression(stack1);
|
24171
24204
|
}
|
24172
24205
|
|
24173
|
-
buffer += "<li id=\"
|
24174
|
-
if (stack1 = helpers.
|
24175
|
-
else { stack1 = depth0.
|
24206
|
+
buffer += "<li id=\"";
|
24207
|
+
if (stack1 = helpers.dom_id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
24208
|
+
else { stack1 = depth0.dom_id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
24176
24209
|
buffer += escapeExpression(stack1)
|
24177
|
-
+ "\" class=\"scrivito_menu_item
|
24210
|
+
+ "\" class=\"scrivito_menu_item ";
|
24211
|
+
if (stack1 = helpers.dom_id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
24212
|
+
else { stack1 = depth0.dom_id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
24213
|
+
buffer += escapeExpression(stack1)
|
24214
|
+
+ "\n ";
|
24178
24215
|
stack1 = helpers['if'].call(depth0, depth0.is_action_required, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
24179
24216
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
24180
24217
|
buffer += "\n ";
|
@@ -24397,7 +24434,8 @@ $.i18n().load({
|
|
24397
24434
|
'commands.revert_obj.dialog.description': 'Verworfene Änderungen können nicht wiederhergestellt werden.',
|
24398
24435
|
'commands.revert_obj.dialog.confirm': 'Verwerfen',
|
24399
24436
|
|
24400
|
-
'commands.revert_widget.
|
24437
|
+
'commands.revert_widget.content_title': 'Änderungen am Inhalt verwerfen',
|
24438
|
+
'commands.revert_widget.widget_title': 'Änderungen am Widget verwerfen',
|
24401
24439
|
'commands.revert_widget.rtc_workspace': 'Dieses Widget ist Teil der "rtc"-Arbeitskopie, bei der Änderungen an Widgets nicht verworfen werden können.',
|
24402
24440
|
'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.',
|
24403
24441
|
'commands.revert_widget.is_not_modified': 'Dieses Widget wurde nicht geändert. Daher gibt es nichts zu verwerfen.',
|
@@ -24436,18 +24474,24 @@ $.i18n().load({
|
|
24436
24474
|
|
24437
24475
|
'commands.add_widget.title': 'Widget einfügen',
|
24438
24476
|
|
24477
|
+
'commands.add_content.title': 'Inhalt einfügen',
|
24478
|
+
'commands.add_content.not_allowed': 'Es ist nicht erlaubt in dieses Feld beliebige Inhalte einzufügen',
|
24479
|
+
|
24439
24480
|
'obj_sorting_dialog.title': 'Elemente sortieren',
|
24440
24481
|
|
24441
24482
|
'commands.widget_details.title': 'Widget-Eigenschaften',
|
24442
24483
|
'commands.widget_details.no_details_view': 'Dieses Widget hat keine Eigenschaften',
|
24443
24484
|
'commands.widget_details.dialog.title': 'Eigenschaften von "$1"',
|
24444
24485
|
|
24445
|
-
'commands.save_widget_to_clipboard.
|
24486
|
+
'commands.save_widget_to_clipboard.content_title': 'Inhalt zum Kopieren markieren',
|
24487
|
+
'commands.save_widget_to_clipboard.widget_title': 'Widget zum Kopieren markieren',
|
24446
24488
|
|
24447
|
-
'commands.copy_widget_from_clipboard.
|
24489
|
+
'commands.copy_widget_from_clipboard.content_title': 'Kopie des markierten Inhalts anhängen',
|
24490
|
+
'commands.copy_widget_from_clipboard.widget_title': 'Kopie des markierten Widgets anhängen',
|
24448
24491
|
'commands.copy_widget_from_clipboard.paste_forbidden': 'Aufgrund ihres Typs kann das Widget hier nicht eingefügt werden. Nur Widgets der folgenden Typen können hierher verschoben oder kopiert werden: $1',
|
24449
24492
|
|
24450
|
-
'commands.delete_widget.
|
24493
|
+
'commands.delete_widget.content_title': 'Inhalt löschen',
|
24494
|
+
'commands.delete_widget.widget_title': 'Widget löschen',
|
24451
24495
|
'commands.delete_widget.dialog.title': 'Wirklich dieses Widget löschen?',
|
24452
24496
|
'commands.delete_widget.dialog.description': 'Ein gelöschtes Widget kann nicht wiederhergestellt werden.',
|
24453
24497
|
'commands.delete_widget.dialog.confirm': 'Löschen',
|
@@ -24612,7 +24656,8 @@ $.i18n().load({
|
|
24612
24656
|
'commands.revert_obj.dialog.description': 'Discarded changes cannot be restored.',
|
24613
24657
|
'commands.revert_obj.dialog.confirm': 'Discard',
|
24614
24658
|
|
24615
|
-
'commands.revert_widget.
|
24659
|
+
'commands.revert_widget.content_title': 'Discard changes to content',
|
24660
|
+
'commands.revert_widget.widget_title': 'Discard changes to widget',
|
24616
24661
|
'commands.revert_widget.rtc_workspace': 'This widget is part of the "rtc" working copy, for which discarding changes to a widgets is not supported.',
|
24617
24662
|
'commands.revert_widget.is_new': 'This is a new widget. To discard the creation of this widget, please delete it.',
|
24618
24663
|
'commands.revert_widget.is_not_modified': 'This widget has not been modified. Therefore, nothing can be discarded.',
|
@@ -24653,16 +24698,22 @@ $.i18n().load({
|
|
24653
24698
|
|
24654
24699
|
'commands.add_widget.title': 'Insert widget',
|
24655
24700
|
|
24701
|
+
'commands.add_content.title': 'Insert content',
|
24702
|
+
'commands.add_content.not_allowed': 'It is not allowed to insert random content into this field.',
|
24703
|
+
|
24656
24704
|
'commands.widget_details.title': 'Widget properties',
|
24657
24705
|
'commands.widget_details.no_details_view': 'This widget has no properties',
|
24658
24706
|
'commands.widget_details.dialog.title': 'Properties of "$1"',
|
24659
24707
|
|
24660
|
-
'commands.save_widget_to_clipboard.
|
24708
|
+
'commands.save_widget_to_clipboard.content_title': 'Mark content for copying',
|
24709
|
+
'commands.save_widget_to_clipboard.widget_title': 'Mark widget for copying',
|
24661
24710
|
|
24662
|
-
'commands.copy_widget_from_clipboard.
|
24711
|
+
'commands.copy_widget_from_clipboard.content_title': 'Append copy of marked content',
|
24712
|
+
'commands.copy_widget_from_clipboard.widget_title': 'Append copy of marked widget',
|
24663
24713
|
'commands.copy_widget_from_clipboard.paste_forbidden': 'Due to its type, the widget cannot be moved or copied here. Only widgets of the following types can be inserted here: $1',
|
24664
24714
|
|
24665
|
-
'commands.delete_widget.
|
24715
|
+
'commands.delete_widget.content_title': 'Delete content',
|
24716
|
+
'commands.delete_widget.widget_title': 'Delete widget',
|
24666
24717
|
'commands.delete_widget.dialog.title': 'Really delete this widget?',
|
24667
24718
|
'commands.delete_widget.dialog.description': 'A deleted widget cannot be restored.',
|
24668
24719
|
'commands.delete_widget.dialog.confirm': 'Delete',
|
@@ -24978,6 +25029,45 @@ var scrivito = {};
|
|
24978
25029
|
return scrivito.obj_class_defaults.lookup(content_type);
|
24979
25030
|
},
|
24980
25031
|
|
25032
|
+
// @api public
|
25033
|
+
configure_menu_order: function(order) {
|
25034
|
+
scrivito.menu_order = order;
|
25035
|
+
},
|
25036
|
+
|
25037
|
+
pattern_sort: function(items, patterns) {
|
25038
|
+
if (patterns && patterns.length) {
|
25039
|
+
var results = [];
|
25040
|
+
_.each(patterns, function(pattern, index) {
|
25041
|
+
if (!pattern.match(/(.*)\.\*$/)) {
|
25042
|
+
var hit = _.find(items, function(item) { return item.id() === pattern; });
|
25043
|
+
if (hit) {
|
25044
|
+
results[index] = hit;
|
25045
|
+
items = _.without(items, hit);
|
25046
|
+
}
|
25047
|
+
}
|
25048
|
+
});
|
25049
|
+
_.each(patterns, function(pattern, index) {
|
25050
|
+
if (pattern.match(/(.*)\.\*$/)) {
|
25051
|
+
var hits = _.select(items, function(item) {
|
25052
|
+
return !item.id().indexOf(pattern.replace('.*', ''));
|
25053
|
+
});
|
25054
|
+
if (hits.length) {
|
25055
|
+
results[index] = hits;
|
25056
|
+
items = _.difference(items, hits);
|
25057
|
+
}
|
25058
|
+
}
|
25059
|
+
});
|
25060
|
+
return _.flatten(_.compact(results.concat(items)));
|
25061
|
+
} else {
|
25062
|
+
return items;
|
25063
|
+
}
|
25064
|
+
},
|
25065
|
+
|
25066
|
+
// @api beta
|
25067
|
+
register_select_content: function(select_content) {
|
25068
|
+
scrivito.select_content = select_content;
|
25069
|
+
},
|
25070
|
+
|
24981
25071
|
init: function(config) {
|
24982
25072
|
scrivito.config = config;
|
24983
25073
|
|
@@ -25007,6 +25097,7 @@ var scrivito = {};
|
|
25007
25097
|
|
25008
25098
|
scrivito.widget_reloading.init();
|
25009
25099
|
scrivito.widget_sorting.init();
|
25100
|
+
scrivito.content_upload.init();
|
25010
25101
|
scrivito.reloading.init();
|
25011
25102
|
|
25012
25103
|
window.onbeforeunload = scrivito.warn_before_unloading;
|
@@ -25110,11 +25201,41 @@ var scrivito = {};
|
|
25110
25201
|
var get_menu = function(dom_element) {
|
25111
25202
|
assert_valid_dom_element(dom_element);
|
25112
25203
|
var cms_element = build_cms_element(dom_element);
|
25204
|
+
var fetch_menu = function() { return cms_element.menu(); };
|
25205
|
+
|
25113
25206
|
return {
|
25114
|
-
|
25115
|
-
|
25116
|
-
|
25207
|
+
list: function() { return fetch_menu(); },
|
25208
|
+
|
25209
|
+
add: function(id, params) {
|
25210
|
+
var menu = fetch_menu();
|
25211
|
+
menu.push(scrivito.command.create_instance(_.extend(params, {id: id})));
|
25212
|
+
cms_element.set_menu(menu);
|
25213
|
+
},
|
25214
|
+
|
25215
|
+
update: function(id, params) {
|
25216
|
+
var menu = fetch_menu();
|
25217
|
+
_.find(menu, function(command, index) {
|
25218
|
+
if (command.id() === id) {
|
25219
|
+
return command.update_params(params);
|
25220
|
+
}
|
25221
|
+
});
|
25222
|
+
cms_element.set_menu(menu);
|
25223
|
+
},
|
25224
|
+
|
25225
|
+
replace: function(id, params) {
|
25226
|
+
var menu = fetch_menu();
|
25227
|
+
_.find(menu, function(command, index) {
|
25228
|
+
if (command.id() === id) {
|
25229
|
+
return menu[index] = scrivito.command.create_instance(_.extend(params, {id: id}));
|
25230
|
+
}
|
25231
|
+
});
|
25117
25232
|
cms_element.set_menu(menu);
|
25233
|
+
},
|
25234
|
+
|
25235
|
+
remove: function(id) {
|
25236
|
+
var menu = fetch_menu();
|
25237
|
+
var command = _.find(menu, function(command) { return command.id() === id; });
|
25238
|
+
cms_element.set_menu(_.without(menu, command));
|
25118
25239
|
}
|
25119
25240
|
};
|
25120
25241
|
};
|
@@ -25230,8 +25351,9 @@ var scrivito = {};
|
|
25230
25351
|
gui: {
|
25231
25352
|
start: function() {
|
25232
25353
|
scrivito.gui.on('document', function(document) {
|
25233
|
-
document.dom_element().find('body')
|
25234
|
-
|
25354
|
+
var body = document.dom_element().find('body');
|
25355
|
+
body.attr('data-scrivito-display-mode', scrivito.editing_context.display_mode);
|
25356
|
+
_.each(['dragenter', 'dragover', 'drop'], function(e) { body.on(e, false); });
|
25235
25357
|
});
|
25236
25358
|
|
25237
25359
|
$('body').append('<div id="scrivito_editing"></div>');
|
@@ -25518,12 +25640,17 @@ var scrivito = {};
|
|
25518
25640
|
return params.id;
|
25519
25641
|
},
|
25520
25642
|
|
25643
|
+
dom_id: function() {
|
25644
|
+
return params.id.replace(/\./g, '_');
|
25645
|
+
},
|
25646
|
+
|
25521
25647
|
title: function() {
|
25522
|
-
|
25648
|
+
var title = params.title;
|
25649
|
+
return typeof title === 'function' ? title() : title;
|
25523
25650
|
},
|
25524
25651
|
|
25525
25652
|
icon: function() {
|
25526
|
-
return params.icon;
|
25653
|
+
return params.icon || '';
|
25527
25654
|
},
|
25528
25655
|
|
25529
25656
|
tooltip: function() {
|
@@ -25578,6 +25705,10 @@ var scrivito = {};
|
|
25578
25705
|
return true;
|
25579
25706
|
}
|
25580
25707
|
return false;
|
25708
|
+
},
|
25709
|
+
|
25710
|
+
update_params: function(new_params) {
|
25711
|
+
return _.extend(params, new_params);
|
25581
25712
|
}
|
25582
25713
|
};
|
25583
25714
|
|
@@ -25590,8 +25721,13 @@ var scrivito = {};
|
|
25590
25721
|
$.extend(scrivito, {
|
25591
25722
|
menu_item: {
|
25592
25723
|
create_instance: function(command) {
|
25724
|
+
var icon = command.icon();
|
25725
|
+
var icon_template = 'menu_item/' + (icon.indexOf('&') ? 'customer' : 'factory') + '_icon';
|
25726
|
+
|
25593
25727
|
var render_menu_item = function() {
|
25594
|
-
return scrivito.template.render('menu_item', command)
|
25728
|
+
return scrivito.template.render('menu_item', _.extend({}, command, {icon: function() {
|
25729
|
+
return scrivito.template.render(icon_template, {icon: icon});
|
25730
|
+
}}));
|
25595
25731
|
};
|
25596
25732
|
|
25597
25733
|
return {
|
@@ -25599,11 +25735,9 @@ var scrivito = {};
|
|
25599
25735
|
if (command.is_present()) {
|
25600
25736
|
var view;
|
25601
25737
|
if (command.needs_update()) {
|
25602
|
-
var id = _.uniqueId(
|
25738
|
+
var id = _.uniqueId(command.dom_id());
|
25603
25739
|
view = scrivito.template.render('menu_item/spinner', {id: id});
|
25604
|
-
command.update().then(function() {
|
25605
|
-
$('#' + id).replaceWith(render_menu_item());
|
25606
|
-
});
|
25740
|
+
command.update().then(function() { $('#'+id).replaceWith(render_menu_item()); });
|
25607
25741
|
} else {
|
25608
25742
|
view = render_menu_item();
|
25609
25743
|
}
|
@@ -25889,7 +26023,7 @@ var scrivito = {};
|
|
25889
26023
|
}));
|
25890
26024
|
|
25891
26025
|
var bind_command = function(command) {
|
25892
|
-
workspace_select.on('click', '#
|
26026
|
+
workspace_select.on('click', '#'+command.dom_id(), function() {
|
25893
26027
|
return command.execute();
|
25894
26028
|
});
|
25895
26029
|
};
|
@@ -26030,7 +26164,7 @@ var scrivito = {};
|
|
26030
26164
|
var query_params = {};
|
26031
26165
|
|
26032
26166
|
if (!!is_binary) {
|
26033
|
-
base_url += '__scrivito/
|
26167
|
+
base_url += '__scrivito/resource_details/';
|
26034
26168
|
query_params.return_to = document.URL;
|
26035
26169
|
}
|
26036
26170
|
|
@@ -26453,7 +26587,9 @@ var scrivito = {};
|
|
26453
26587
|
is_current_page_restricted: scrivito.is_current_page_restricted,
|
26454
26588
|
in_editable_view: scrivito.in_editable_view,
|
26455
26589
|
register_default_obj_class_for_content_type: scrivito.register_default_obj_class_for_content_type,
|
26456
|
-
default_obj_class_for_content_type: scrivito.default_obj_class_for_content_type
|
26590
|
+
default_obj_class_for_content_type: scrivito.default_obj_class_for_content_type,
|
26591
|
+
register_select_content: scrivito.register_select_content,
|
26592
|
+
configure_menu_order: scrivito.configure_menu_order
|
26457
26593
|
});
|
26458
26594
|
},
|
26459
26595
|
|
@@ -27076,13 +27212,7 @@ var scrivito = {};
|
|
27076
27212
|
|
27077
27213
|
details_src: function() {
|
27078
27214
|
// TODO unify with ajax url generation
|
27079
|
-
return '/__scrivito/
|
27080
|
-
},
|
27081
|
-
|
27082
|
-
fetch_details_markup: function() {
|
27083
|
-
return scrivito.ajax('GET', 'objs/' + that.id() + '/details').then(function(data) {
|
27084
|
-
return data.markup;
|
27085
|
-
});
|
27215
|
+
return '/__scrivito/page_details/' + that.id();
|
27086
27216
|
},
|
27087
27217
|
|
27088
27218
|
mark_resolved: function() {
|
@@ -27443,6 +27573,10 @@ var scrivito = {};
|
|
27443
27573
|
return !!that.placement_modification();
|
27444
27574
|
},
|
27445
27575
|
|
27576
|
+
is_content_widget: function() {
|
27577
|
+
return widget_class_name === 'Scrivito::ContentWidget';
|
27578
|
+
},
|
27579
|
+
|
27446
27580
|
save: function(widget_attributes) {
|
27447
27581
|
var obj_attributes = build_obj_attributes(widget_attributes);
|
27448
27582
|
return that.obj().save(obj_attributes).then(function(obj_data) {
|
@@ -27454,10 +27588,6 @@ var scrivito = {};
|
|
27454
27588
|
return that.obj().destroy_widget(that.id());
|
27455
27589
|
},
|
27456
27590
|
|
27457
|
-
fetch_details_markup: function() {
|
27458
|
-
return that.fetch_markup('widget_details');
|
27459
|
-
},
|
27460
|
-
|
27461
27591
|
details_src: function() {
|
27462
27592
|
// TODO unify with ajax url generation
|
27463
27593
|
return "/__scrivito/" + that.markup_url("widget_details");
|
@@ -27535,11 +27665,7 @@ var scrivito = {};
|
|
27535
27665
|
},
|
27536
27666
|
|
27537
27667
|
has_details_view: function() {
|
27538
|
-
return that.dom_element().attr('data-scrivito-private-widget-has-details-view')
|
27539
|
-
},
|
27540
|
-
|
27541
|
-
fetch_details_markup: function() {
|
27542
|
-
return that.widget().fetch_details_markup();
|
27668
|
+
return !!that.dom_element().attr('data-scrivito-private-widget-has-details-view');
|
27543
27669
|
},
|
27544
27670
|
|
27545
27671
|
fetch_show_markup: function() {
|
@@ -27602,13 +27728,16 @@ var scrivito = {};
|
|
27602
27728
|
},
|
27603
27729
|
|
27604
27730
|
create_widget: function(widget_class, widget_element) {
|
27605
|
-
|
27606
|
-
return add_widget(widget_spec, widget_element);
|
27731
|
+
return add_widget({create: {_obj_class: widget_class}}, widget_element);
|
27607
27732
|
},
|
27608
27733
|
|
27609
|
-
copy_widget: function(
|
27610
|
-
|
27611
|
-
|
27734
|
+
copy_widget: function(params, widget_element) {
|
27735
|
+
return add_widget({copy: params}, widget_element);
|
27736
|
+
},
|
27737
|
+
|
27738
|
+
create_content_widget: function(content, widget_element) {
|
27739
|
+
return add_widget({create: {_obj_class: 'Scrivito::ContentWidget', content: content}},
|
27740
|
+
widget_element);
|
27612
27741
|
},
|
27613
27742
|
|
27614
27743
|
fetch_widget_class_selection: function() {
|
@@ -27641,6 +27770,21 @@ var scrivito = {};
|
|
27641
27770
|
}
|
27642
27771
|
},
|
27643
27772
|
|
27773
|
+
is_content_widget_allowed: function() {
|
27774
|
+
return that.is_valid_child_class('Scrivito::ContentWidget');
|
27775
|
+
},
|
27776
|
+
|
27777
|
+
prepend_widget_markup: function(widget_markup, widget_element) {
|
27778
|
+
var dom_element = $($.trim(widget_markup));
|
27779
|
+
if (widget_element) {
|
27780
|
+
widget_element.dom_element().before(dom_element);
|
27781
|
+
} else {
|
27782
|
+
that.dom_element().prepend(dom_element);
|
27783
|
+
}
|
27784
|
+
scrivito.gui.new_content(dom_element.get(0));
|
27785
|
+
return dom_element;
|
27786
|
+
},
|
27787
|
+
|
27644
27788
|
append_widget_markup: function(widget_markup, widget_element) {
|
27645
27789
|
var dom_element = $($.trim(widget_markup));
|
27646
27790
|
if (widget_element) {
|
@@ -28543,7 +28687,7 @@ var scrivito = {};
|
|
28543
28687
|
scrivito.close_all_menus();
|
28544
28688
|
|
28545
28689
|
var menu = $(scrivito.template.render('menu', {
|
28546
|
-
menu_items: _.map(commands, function(command) {
|
28690
|
+
menu_items: _.map(scrivito.pattern_sort(commands, scrivito.menu_order), function(command) {
|
28547
28691
|
return scrivito.menu_item.create_instance(command);
|
28548
28692
|
})
|
28549
28693
|
}));
|
@@ -28563,7 +28707,7 @@ var scrivito = {};
|
|
28563
28707
|
});
|
28564
28708
|
|
28565
28709
|
_.each(commands, function(command) {
|
28566
|
-
menu.on('click', '.
|
28710
|
+
menu.on('click', '.'+command.dom_id(), function() {
|
28567
28711
|
if (command.is_enabled()) {
|
28568
28712
|
menu.data('scrivito-menu-close')();
|
28569
28713
|
}
|
@@ -28627,7 +28771,7 @@ var scrivito = {};
|
|
28627
28771
|
});
|
28628
28772
|
|
28629
28773
|
_.each(commands, function(command) {
|
28630
|
-
menu.on('click', '.
|
28774
|
+
menu.on('click', '.'+command.dom_id(), function() {
|
28631
28775
|
if (command.is_enabled()) {
|
28632
28776
|
menu.data('scrivito-menu-close')();
|
28633
28777
|
}
|
@@ -28740,11 +28884,61 @@ var scrivito = {};
|
|
28740
28884
|
}
|
28741
28885
|
});
|
28742
28886
|
}());
|
28887
|
+
(function() {
|
28888
|
+
$.extend(scrivito, {
|
28889
|
+
add_content_command: function(cms_element) {
|
28890
|
+
var widget_field_element, widget_element;
|
28891
|
+
if (cms_element.widget_field) {
|
28892
|
+
widget_element = cms_element;
|
28893
|
+
} else {
|
28894
|
+
widget_field_element = cms_element;
|
28895
|
+
}
|
28896
|
+
|
28897
|
+
return scrivito.command.create_instance({
|
28898
|
+
id: 'scrivito.sdk.add_content',
|
28899
|
+
title: scrivito.t('commands.add_content.title'),
|
28900
|
+
icon: '',
|
28901
|
+
|
28902
|
+
present: function() {
|
28903
|
+
return scrivito.select_content && scrivito.editing_context.is_editing_mode() &&
|
28904
|
+
(widget_element || widget_field_element.is_empty());
|
28905
|
+
},
|
28906
|
+
|
28907
|
+
disabled: function() {
|
28908
|
+
if (!(widget_field_element || widget_element.widget_field())
|
28909
|
+
.is_content_widget_allowed()) {
|
28910
|
+
return scrivito.t('commands.add_content.not_allowed');
|
28911
|
+
}
|
28912
|
+
},
|
28913
|
+
|
28914
|
+
execute: function() {
|
28915
|
+
if (!widget_field_element) {
|
28916
|
+
widget_field_element = widget_element.widget_field();
|
28917
|
+
}
|
28918
|
+
|
28919
|
+
scrivito.select_content().then(function(contents) {
|
28920
|
+
var content = contents[0];
|
28921
|
+
if (content) {
|
28922
|
+
var create_widget = widget_field_element.create_content_widget(content, widget_element);
|
28923
|
+
scrivito.with_saving_overlay(create_widget.then(function(widget) {
|
28924
|
+
return widget.fetch_show_markup().then(function(markup) {
|
28925
|
+
var dom_element = widget_field_element.append_widget_markup(markup, widget_element);
|
28926
|
+
scrivito.ensure_fully_visible_within_application_window(dom_element);
|
28927
|
+
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
28928
|
+
});
|
28929
|
+
}));
|
28930
|
+
}
|
28931
|
+
});
|
28932
|
+
}
|
28933
|
+
});
|
28934
|
+
}
|
28935
|
+
});
|
28936
|
+
}());
|
28743
28937
|
(function() {
|
28744
28938
|
$.extend(scrivito, {
|
28745
28939
|
add_subpage_command: function(child_list_element) {
|
28746
28940
|
return scrivito.command.create_instance({
|
28747
|
-
id: 'add_subpage',
|
28941
|
+
id: 'scrivito.sdk.add_subpage',
|
28748
28942
|
title: scrivito.t('commands.add_subpage.title'),
|
28749
28943
|
icon: '',
|
28750
28944
|
tooltip: scrivito.t('commands.add_subpage.tooltip',
|
@@ -28766,22 +28960,29 @@ var scrivito = {};
|
|
28766
28960
|
}());
|
28767
28961
|
(function() {
|
28768
28962
|
$.extend(scrivito, {
|
28769
|
-
add_widget_command: function(
|
28963
|
+
add_widget_command: function(cms_element) {
|
28964
|
+
var widget_field_element, widget_element;
|
28965
|
+
if (cms_element.widget_field) {
|
28966
|
+
widget_element = cms_element;
|
28967
|
+
} else {
|
28968
|
+
widget_field_element = cms_element;
|
28969
|
+
}
|
28970
|
+
|
28770
28971
|
return scrivito.command.create_instance({
|
28771
|
-
id: 'add_widget',
|
28972
|
+
id: 'scrivito.sdk.add_widget',
|
28772
28973
|
title: scrivito.t('commands.add_widget.title'),
|
28773
28974
|
icon: '',
|
28774
28975
|
|
28775
28976
|
present: function() {
|
28776
|
-
|
28777
|
-
|
28778
|
-
} else {
|
28779
|
-
return scrivito.editing_context.is_editing_mode() &&
|
28780
|
-
widget_field_element.widget_elements().length === 0;
|
28781
|
-
}
|
28977
|
+
return scrivito.editing_context.is_editing_mode() &&
|
28978
|
+
(widget_element || widget_field_element.is_empty());
|
28782
28979
|
},
|
28783
28980
|
|
28784
28981
|
execute: function() {
|
28982
|
+
if (!widget_field_element) {
|
28983
|
+
widget_field_element = widget_element.widget_field();
|
28984
|
+
}
|
28985
|
+
|
28785
28986
|
var selection = widget_field_element.fetch_widget_class_selection();
|
28786
28987
|
var choose_widget_obj_class = scrivito.choose_obj_class_dialog(selection, 'add_widget');
|
28787
28988
|
return choose_widget_obj_class.then(function(obj_class) {
|
@@ -28805,7 +29006,7 @@ var scrivito = {};
|
|
28805
29006
|
$.extend(scrivito, {
|
28806
29007
|
copy_page_from_clipboard_command: function(child_list_element) {
|
28807
29008
|
return scrivito.command.create_instance({
|
28808
|
-
id: 'copy_page_from_clipboard',
|
29009
|
+
id: 'scrivito.sdk.copy_page_from_clipboard',
|
28809
29010
|
title: scrivito.t('commands.copy_page_from_clipboard.title'),
|
28810
29011
|
icon: '',
|
28811
29012
|
|
@@ -28833,24 +29034,33 @@ var scrivito = {};
|
|
28833
29034
|
}());
|
28834
29035
|
(function() {
|
28835
29036
|
$.extend(scrivito, {
|
28836
|
-
copy_widget_from_clipboard_command: function(
|
29037
|
+
copy_widget_from_clipboard_command: function(cms_element) {
|
29038
|
+
var widget_field_element, widget_element;
|
29039
|
+
if (cms_element.widget_field) {
|
29040
|
+
widget_element = cms_element;
|
29041
|
+
} else {
|
29042
|
+
widget_field_element = cms_element;
|
29043
|
+
}
|
29044
|
+
|
28837
29045
|
return scrivito.command.create_instance({
|
28838
|
-
id: 'copy_widget_from_clipboard',
|
28839
|
-
title:
|
29046
|
+
id: 'scrivito.sdk.copy_widget_from_clipboard',
|
29047
|
+
title: function() {
|
29048
|
+
return scrivito.t('commands.copy_widget_from_clipboard.' +
|
29049
|
+
(scrivito.widget_clipboard.widget().is_content_widget() ? 'content' : 'widget') +
|
29050
|
+
'_title');
|
29051
|
+
},
|
28840
29052
|
icon: '',
|
28841
29053
|
|
28842
29054
|
present: function() {
|
28843
|
-
|
28844
|
-
|
28845
|
-
|
28846
|
-
return is_editing_mode && is_clipboard_present;
|
28847
|
-
} else {
|
28848
|
-
var is_empty_widget_field = widget_field_element.widget_elements().length === 0;
|
28849
|
-
return is_editing_mode && is_clipboard_present && is_empty_widget_field;
|
28850
|
-
}
|
29055
|
+
return scrivito.editing_context.is_editing_mode() &&
|
29056
|
+
scrivito.widget_clipboard.is_present() &&
|
29057
|
+
(widget_element || widget_field_element.is_empty());
|
28851
29058
|
},
|
28852
29059
|
|
28853
29060
|
disabled: function() {
|
29061
|
+
if (!widget_field_element) {
|
29062
|
+
widget_field_element = widget_element.widget_field();
|
29063
|
+
}
|
28854
29064
|
var widget_class_name = scrivito.widget_clipboard.widget().widget_class_name();
|
28855
29065
|
if (!widget_field_element.is_valid_child_class(widget_class_name)) {
|
28856
29066
|
return scrivito.t('commands.copy_widget_from_clipboard.paste_forbidden',
|
@@ -28859,11 +29069,15 @@ var scrivito = {};
|
|
28859
29069
|
},
|
28860
29070
|
|
28861
29071
|
execute: function() {
|
29072
|
+
if (!widget_field_element) {
|
29073
|
+
widget_field_element = widget_element.widget_field();
|
29074
|
+
}
|
28862
29075
|
var widget = scrivito.widget_clipboard.widget();
|
28863
|
-
var
|
28864
|
-
|
28865
|
-
|
28866
|
-
|
29076
|
+
var copy_widget = widget_field_element.copy_widget({
|
29077
|
+
workspace_id: scrivito.editing_context.selected_workspace.id(),
|
29078
|
+
obj_id: widget.obj().id(),
|
29079
|
+
widget_id: widget.id()
|
29080
|
+
}, widget_element);
|
28867
29081
|
return scrivito.with_saving_overlay(copy_widget.then(function(widget) {
|
28868
29082
|
return widget.fetch_show_markup().then(function(widget_markup) {
|
28869
29083
|
var dom_element = widget_field_element
|
@@ -28882,7 +29096,7 @@ var scrivito = {};
|
|
28882
29096
|
$.extend(scrivito, {
|
28883
29097
|
create_workspace_command: function() {
|
28884
29098
|
return scrivito.command.create_instance({
|
28885
|
-
id: 'create_workspace',
|
29099
|
+
id: 'scrivito.sdk.create_workspace',
|
28886
29100
|
title: scrivito.t('commands.create_workspace.title'),
|
28887
29101
|
icon: '',
|
28888
29102
|
|
@@ -28917,7 +29131,7 @@ var scrivito = {};
|
|
28917
29131
|
}
|
28918
29132
|
|
28919
29133
|
return scrivito.command.create_instance({
|
28920
|
-
id: 'delete_obj',
|
29134
|
+
id: 'scrivito.sdk.delete_obj',
|
28921
29135
|
title: scrivito.t(translations_namespace + '.title'),
|
28922
29136
|
icon: '',
|
28923
29137
|
|
@@ -28958,15 +29172,14 @@ var scrivito = {};
|
|
28958
29172
|
}());
|
28959
29173
|
(function() {
|
28960
29174
|
$.extend(scrivito, {
|
28961
|
-
delete_widget_command: function(
|
29175
|
+
delete_widget_command: function(widget_element) {
|
28962
29176
|
return scrivito.command.create_instance({
|
28963
|
-
id: 'delete_widget',
|
28964
|
-
title: scrivito.t('commands.delete_widget.
|
29177
|
+
id: 'scrivito.sdk.delete_widget',
|
29178
|
+
title: scrivito.t('commands.delete_widget.' +
|
29179
|
+
(widget_element.widget().is_content_widget() ? 'content' : 'widget') + '_title'),
|
28965
29180
|
icon: '',
|
28966
29181
|
|
28967
|
-
present: function() {
|
28968
|
-
return scrivito.editing_context.is_editing_mode();
|
28969
|
-
},
|
29182
|
+
present: function() { return scrivito.editing_context.is_editing_mode(); },
|
28970
29183
|
|
28971
29184
|
execute: function() {
|
28972
29185
|
return scrivito.confirmation_dialog({
|
@@ -28977,13 +29190,12 @@ var scrivito = {};
|
|
28977
29190
|
confirm_button_text: scrivito.t('commands.delete_widget.dialog.confirm'),
|
28978
29191
|
confirm_button_color: 'red'
|
28979
29192
|
}).then(function() {
|
29193
|
+
var widget_field_element = widget_element.widget_field();
|
28980
29194
|
var widget = widget_element.widget();
|
28981
29195
|
widget_element.dom_element().remove();
|
28982
|
-
|
28983
|
-
if (widget_field_element.widget_elements().length === 0) {
|
29196
|
+
if (widget_field_element.is_empty()) {
|
28984
29197
|
scrivito.inplace_marker.refresh();
|
28985
29198
|
}
|
28986
|
-
|
28987
29199
|
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
28988
29200
|
|
28989
29201
|
return widget.destroy().then(function() {
|
@@ -29002,7 +29214,7 @@ var scrivito = {};
|
|
29002
29214
|
$.extend(scrivito, {
|
29003
29215
|
delete_workspace_command: function(workspace) {
|
29004
29216
|
return scrivito.command.create_instance({
|
29005
|
-
id: 'delete_workspace',
|
29217
|
+
id: 'scrivito.sdk.delete_workspace',
|
29006
29218
|
title: scrivito.t('commands.delete_workspace.title'),
|
29007
29219
|
icon: '',
|
29008
29220
|
|
@@ -29028,7 +29240,7 @@ var scrivito = {};
|
|
29028
29240
|
$.extend(scrivito, {
|
29029
29241
|
duplicate_obj_command: function(obj) {
|
29030
29242
|
return scrivito.command.create_instance({
|
29031
|
-
id: 'duplicate_obj',
|
29243
|
+
id: 'scrivito.sdk.duplicate_obj',
|
29032
29244
|
title: scrivito.t('commands.duplicate_obj.title'),
|
29033
29245
|
icon: '',
|
29034
29246
|
|
@@ -29062,7 +29274,7 @@ var scrivito = {};
|
|
29062
29274
|
}
|
29063
29275
|
|
29064
29276
|
return scrivito.command.create_instance({
|
29065
|
-
id: 'mark_resolved_obj',
|
29277
|
+
id: 'scrivito.sdk.mark_resolved_obj',
|
29066
29278
|
title: scrivito.t(translations_namespace + '.title'),
|
29067
29279
|
icon: '',
|
29068
29280
|
|
@@ -29092,7 +29304,7 @@ var scrivito = {};
|
|
29092
29304
|
$.extend(scrivito, {
|
29093
29305
|
move_page_from_clipboard_command: function(child_list_element) {
|
29094
29306
|
return scrivito.command.create_instance({
|
29095
|
-
id: 'move_page_from_clipboard',
|
29307
|
+
id: 'scrivito.sdk.move_page_from_clipboard',
|
29096
29308
|
title: scrivito.t('commands.move_page_from_clipboard.title'),
|
29097
29309
|
icon: '',
|
29098
29310
|
|
@@ -29123,7 +29335,7 @@ var scrivito = {};
|
|
29123
29335
|
$.extend(scrivito, {
|
29124
29336
|
obj_details_command: function(obj) {
|
29125
29337
|
return scrivito.command.create_instance({
|
29126
|
-
id: 'obj_details',
|
29338
|
+
id: 'scrivito.sdk.obj_details',
|
29127
29339
|
title: scrivito.t('commands.obj_details.title'),
|
29128
29340
|
icon: '',
|
29129
29341
|
|
@@ -29170,7 +29382,7 @@ var scrivito = {};
|
|
29170
29382
|
};
|
29171
29383
|
|
29172
29384
|
return scrivito.command.create_instance({
|
29173
|
-
id: 'publish_workspace',
|
29385
|
+
id: 'scrivito.sdk.publish_workspace',
|
29174
29386
|
title: scrivito.t('commands.publish_workspace.title'),
|
29175
29387
|
icon: '',
|
29176
29388
|
tooltip: scrivito.t('commands.publish_workspace.title', workspace.title()),
|
@@ -29205,7 +29417,7 @@ var scrivito = {};
|
|
29205
29417
|
$.extend(scrivito, {
|
29206
29418
|
rebase_workspace_command: function(workspace) {
|
29207
29419
|
return scrivito.command.create_instance({
|
29208
|
-
id: 'rebase_workspace',
|
29420
|
+
id: 'scrivito.sdk.rebase_workspace',
|
29209
29421
|
title: scrivito.t('commands.rebase_workspace.title'),
|
29210
29422
|
icon: '',
|
29211
29423
|
tooltip: scrivito.t('commands.rebase_workspace.tooltip', workspace.title()),
|
@@ -29233,7 +29445,7 @@ var scrivito = {};
|
|
29233
29445
|
$.extend(scrivito, {
|
29234
29446
|
rename_workspace_command: function(workspace) {
|
29235
29447
|
return scrivito.command.create_instance({
|
29236
|
-
id: 'rename_workspace',
|
29448
|
+
id: 'scrivito.sdk.rename_workspace',
|
29237
29449
|
title: scrivito.t('commands.rename_workspace.title'),
|
29238
29450
|
icon: '',
|
29239
29451
|
|
@@ -29264,7 +29476,7 @@ var scrivito = {};
|
|
29264
29476
|
}
|
29265
29477
|
|
29266
29478
|
return scrivito.command.create_instance({
|
29267
|
-
id: 'restore_obj',
|
29479
|
+
id: 'scrivito.sdk.restore_obj',
|
29268
29480
|
title: scrivito.t(translations_namespace + '.title'),
|
29269
29481
|
icon: '',
|
29270
29482
|
|
@@ -29292,7 +29504,7 @@ var scrivito = {};
|
|
29292
29504
|
restore_widget_command: function(widget_element) {
|
29293
29505
|
var widget = widget_element.widget();
|
29294
29506
|
return scrivito.command.create_instance({
|
29295
|
-
id: 'restore_widget',
|
29507
|
+
id: 'scrivito.sdk.restore_widget',
|
29296
29508
|
title: scrivito.t('commands.restore_widget.title'),
|
29297
29509
|
icon: '',
|
29298
29510
|
|
@@ -29323,7 +29535,7 @@ var scrivito = {};
|
|
29323
29535
|
}
|
29324
29536
|
|
29325
29537
|
return scrivito.command.create_instance({
|
29326
|
-
id: 'revert_obj',
|
29538
|
+
id: 'scrivito.sdk.revert_obj',
|
29327
29539
|
title: scrivito.t(translations_namespace + '.title'),
|
29328
29540
|
icon: '',
|
29329
29541
|
|
@@ -29371,8 +29583,9 @@ var scrivito = {};
|
|
29371
29583
|
revert_widget_command: function(widget_element) {
|
29372
29584
|
var widget = widget_element.widget();
|
29373
29585
|
return scrivito.command.create_instance({
|
29374
|
-
id: 'revert_widget',
|
29375
|
-
title: scrivito.
|
29586
|
+
id: 'scrivito.sdk.revert_widget',
|
29587
|
+
title: scrivito.t('commands.revert_widget.' +
|
29588
|
+
(widget.is_content_widget() ? 'content' : 'widget') + '_title'),
|
29376
29589
|
icon: '',
|
29377
29590
|
|
29378
29591
|
present: function() {
|
@@ -29384,24 +29597,22 @@ var scrivito = {};
|
|
29384
29597
|
return scrivito.t('commands.revert_widget.rtc_workspace');
|
29385
29598
|
}
|
29386
29599
|
if (widget.is_new()) {
|
29387
|
-
return scrivito.
|
29600
|
+
return scrivito.t('commands.revert_widget.is_new');
|
29388
29601
|
}
|
29389
29602
|
if (!widget.is_modified()) {
|
29390
|
-
return scrivito.
|
29603
|
+
return scrivito.t('commands.revert_widget.is_not_modified');
|
29391
29604
|
}
|
29392
29605
|
},
|
29393
29606
|
|
29394
|
-
update: function() {
|
29395
|
-
return widget.update_modification();
|
29396
|
-
},
|
29607
|
+
update: function() { return widget.update_modification(); },
|
29397
29608
|
|
29398
29609
|
execute: function() {
|
29399
29610
|
return scrivito.confirmation_dialog({
|
29400
|
-
title: scrivito.
|
29401
|
-
description: scrivito.
|
29611
|
+
title: scrivito.t('commands.revert_widget.dialog.title'),
|
29612
|
+
description: scrivito.t('commands.revert_widget.dialog.description'),
|
29402
29613
|
icon: '',
|
29403
29614
|
color: 'red',
|
29404
|
-
confirm_button_text: scrivito.
|
29615
|
+
confirm_button_text: scrivito.t('commands.revert_obj.dialog.confirm'),
|
29405
29616
|
confirm_button_color: 'red'
|
29406
29617
|
}).then(function() {
|
29407
29618
|
var dom_element = widget_element.dom_element();
|
@@ -29418,7 +29629,7 @@ var scrivito = {};
|
|
29418
29629
|
$.extend(scrivito, {
|
29419
29630
|
save_obj_to_clipboard_command: function(obj) {
|
29420
29631
|
return scrivito.command.create_instance({
|
29421
|
-
id: 'save_obj_to_clipboard',
|
29632
|
+
id: 'scrivito.sdk.save_obj_to_clipboard',
|
29422
29633
|
title: scrivito.t('commands.save_obj_to_clipboard.title'),
|
29423
29634
|
icon: '',
|
29424
29635
|
|
@@ -29443,17 +29654,12 @@ var scrivito = {};
|
|
29443
29654
|
$.extend(scrivito, {
|
29444
29655
|
save_widget_to_clipboard_command: function(widget_element) {
|
29445
29656
|
return scrivito.command.create_instance({
|
29446
|
-
id: 'save_widget_to_clipboard',
|
29447
|
-
title: scrivito.t('commands.save_widget_to_clipboard.
|
29657
|
+
id: 'scrivito.sdk.save_widget_to_clipboard',
|
29658
|
+
title: scrivito.t('commands.save_widget_to_clipboard.' +
|
29659
|
+
(widget_element.widget().is_content_widget() ? 'content' : 'widget') + '_title'),
|
29448
29660
|
icon: '',
|
29449
|
-
|
29450
|
-
|
29451
|
-
return scrivito.editing_context.is_editing_mode();
|
29452
|
-
},
|
29453
|
-
|
29454
|
-
execute: function() {
|
29455
|
-
scrivito.widget_clipboard.save_widget(widget_element.widget());
|
29456
|
-
}
|
29661
|
+
present: function() { return scrivito.editing_context.is_editing_mode(); },
|
29662
|
+
execute: function() { scrivito.widget_clipboard.save_widget(widget_element.widget()); }
|
29457
29663
|
});
|
29458
29664
|
}
|
29459
29665
|
});
|
@@ -29462,13 +29668,13 @@ var scrivito = {};
|
|
29462
29668
|
$.extend(scrivito, {
|
29463
29669
|
select_workspace_command: function(workspace) {
|
29464
29670
|
return scrivito.command.create_instance({
|
29465
|
-
id: 'select_workspace_'
|
29671
|
+
id: 'scrivito.sdk.select_workspace_'+workspace.id(),
|
29466
29672
|
title: workspace.title(),
|
29467
29673
|
icon: workspace.icon(),
|
29468
29674
|
|
29469
29675
|
execute: function() {
|
29470
29676
|
scrivito.with_saving_overlay(
|
29471
|
-
|
29677
|
+
scrivito.redirect_to('?_scrivito_workspace_id='+workspace.id()));
|
29472
29678
|
}
|
29473
29679
|
});
|
29474
29680
|
}
|
@@ -29478,7 +29684,7 @@ var scrivito = {};
|
|
29478
29684
|
$.extend(scrivito, {
|
29479
29685
|
sort_items_command: function(child_list_element) {
|
29480
29686
|
return scrivito.command.create_instance({
|
29481
|
-
id: 'sort_items',
|
29687
|
+
id: 'scrivito.sdk.sort_items',
|
29482
29688
|
title: scrivito.t('commands.sort_items.title'),
|
29483
29689
|
icon: '',
|
29484
29690
|
tooltip: scrivito.t('commands.sort_items.tooltip',
|
@@ -29566,14 +29772,13 @@ var scrivito = {};
|
|
29566
29772
|
};
|
29567
29773
|
|
29568
29774
|
return scrivito.command.create_instance({
|
29569
|
-
id: 'widget_details',
|
29775
|
+
id: 'scrivito.sdk.widget_details',
|
29570
29776
|
title: scrivito.t('commands.widget_details.title'),
|
29571
29777
|
icon: '',
|
29572
29778
|
|
29573
29779
|
present: function() {
|
29574
|
-
return scrivito.editing_context.is_editing_mode() ||
|
29575
|
-
widget().is_modified() ||
|
29576
|
-
widget().is_placement_modified();
|
29780
|
+
return !widget().is_content_widget() && (scrivito.editing_context.is_editing_mode() ||
|
29781
|
+
widget().is_modified() || widget().is_placement_modified());
|
29577
29782
|
},
|
29578
29783
|
|
29579
29784
|
disabled: function() {
|
@@ -29596,7 +29801,7 @@ var scrivito = {};
|
|
29596
29801
|
$.extend(scrivito, {
|
29597
29802
|
workspace_changes_command: function() {
|
29598
29803
|
return scrivito.command.create_instance({
|
29599
|
-
id: 'workspace_changes',
|
29804
|
+
id: 'scrivito.sdk.workspace_changes',
|
29600
29805
|
title: scrivito.t('commands.workspace_changes.title'),
|
29601
29806
|
icon: '',
|
29602
29807
|
|
@@ -29611,7 +29816,7 @@ var scrivito = {};
|
|
29611
29816
|
$.extend(scrivito, {
|
29612
29817
|
workspace_settings_command: function(workspace) {
|
29613
29818
|
return scrivito.command.create_instance({
|
29614
|
-
id: 'workspace_settings',
|
29819
|
+
id: 'scrivito.sdk.workspace_settings',
|
29615
29820
|
title: scrivito.t('commands.workspace_settings.title'),
|
29616
29821
|
icon: '',
|
29617
29822
|
|
@@ -29660,13 +29865,14 @@ var scrivito = {};
|
|
29660
29865
|
_.each(scrivito.widget_element.all($(content)), function(widget_element) {
|
29661
29866
|
var widget_field_element = widget_element.widget_field();
|
29662
29867
|
widget_element.set_menu([
|
29663
|
-
scrivito.add_widget_command(
|
29868
|
+
scrivito.add_widget_command(widget_element),
|
29869
|
+
scrivito.add_content_command(widget_element),
|
29664
29870
|
scrivito.widget_details_command(widget_element),
|
29665
29871
|
scrivito.save_widget_to_clipboard_command(widget_element),
|
29666
|
-
scrivito.copy_widget_from_clipboard_command(
|
29872
|
+
scrivito.copy_widget_from_clipboard_command(widget_element),
|
29667
29873
|
scrivito.revert_widget_command(widget_element),
|
29668
29874
|
scrivito.restore_widget_command(widget_element),
|
29669
|
-
scrivito.delete_widget_command(
|
29875
|
+
scrivito.delete_widget_command(widget_element)
|
29670
29876
|
].concat(widget_element.menu()));
|
29671
29877
|
});
|
29672
29878
|
});
|
@@ -29684,6 +29890,7 @@ var scrivito = {};
|
|
29684
29890
|
_.each(scrivito.widget_field_element.all($(content)), function(widget_field_element) {
|
29685
29891
|
widget_field_element.set_menu([
|
29686
29892
|
scrivito.add_widget_command(widget_field_element),
|
29893
|
+
scrivito.add_content_command(widget_field_element),
|
29687
29894
|
scrivito.copy_widget_from_clipboard_command(widget_field_element)
|
29688
29895
|
].concat(widget_field_element.menu()));
|
29689
29896
|
});
|
@@ -30003,6 +30210,76 @@ var scrivito = {};
|
|
30003
30210
|
add_field_changes(changes._widget_pool[parent_widget_id], widget_field_element);
|
30004
30211
|
};
|
30005
30212
|
}());
|
30213
|
+
(function() {
|
30214
|
+
$.extend(scrivito, {
|
30215
|
+
content_upload: {
|
30216
|
+
init: function() {
|
30217
|
+
scrivito.on('content', function(content) {
|
30218
|
+
if (scrivito.in_editable_view()) {
|
30219
|
+
_.each(scrivito.widget_field_element.all($(content)), function(widget_field_element) {
|
30220
|
+
scrivito.content_upload.create(widget_field_element);
|
30221
|
+
});
|
30222
|
+
|
30223
|
+
_.each(scrivito.widget_element.all($(content)), function(widget_element) {
|
30224
|
+
scrivito.content_upload.create(widget_element.widget_field(), widget_element);
|
30225
|
+
});
|
30226
|
+
}
|
30227
|
+
});
|
30228
|
+
},
|
30229
|
+
|
30230
|
+
create: function(widget_field_element, widget_element) {
|
30231
|
+
var dropzone = (widget_element || widget_field_element).dom_element();
|
30232
|
+
var is_active = function() { return widget_element || widget_field_element.is_empty(); };
|
30233
|
+
|
30234
|
+
dropzone.on('dragenter', function() {
|
30235
|
+
if (is_active()) {
|
30236
|
+
dropzone.addClass('scrivito_content_upload');
|
30237
|
+
}
|
30238
|
+
return false;
|
30239
|
+
});
|
30240
|
+
|
30241
|
+
dropzone.on('dragleave', function() {
|
30242
|
+
if (is_active()) {
|
30243
|
+
dropzone.removeClass('scrivito_content_upload');
|
30244
|
+
}
|
30245
|
+
return false;
|
30246
|
+
});
|
30247
|
+
|
30248
|
+
dropzone.on('drop', function(event) {
|
30249
|
+
if (is_active()) {
|
30250
|
+
dropzone.removeClass('scrivito_content_upload');
|
30251
|
+
var data_transfer = event.originalEvent.dataTransfer;
|
30252
|
+
if (data_transfer) {
|
30253
|
+
var files = data_transfer.files;
|
30254
|
+
if (files.length === 1) {
|
30255
|
+
scrivito.content_upload.upload(files[0], widget_field_element, widget_element);
|
30256
|
+
}
|
30257
|
+
}
|
30258
|
+
}
|
30259
|
+
return false;
|
30260
|
+
});
|
30261
|
+
},
|
30262
|
+
|
30263
|
+
upload: function(file, widget_field_element, widget_element) {
|
30264
|
+
var name = file.name.replace(/[^a-z0-9_.$\-]/ig, '-');
|
30265
|
+
var path = '_resources/'+Math.floor(Math.random() * 1000)+'/'+name;
|
30266
|
+
var obj_class = scrivito.default_obj_class_for_content_type(file.type);
|
30267
|
+
|
30268
|
+
var create_obj = scrivito.create_obj({blob: file, _path: path, _obj_class: obj_class});
|
30269
|
+
scrivito.with_saving_overlay(create_obj.then(function(obj) {
|
30270
|
+
var create_widget = widget_field_element.create_content_widget(obj.id, widget_element);
|
30271
|
+
return create_widget.then(function(widget) {
|
30272
|
+
return widget.fetch_show_markup().then(function(markup) {
|
30273
|
+
var dom_element = widget_field_element.prepend_widget_markup(markup, widget_element);
|
30274
|
+
scrivito.ensure_fully_visible_within_application_window(dom_element);
|
30275
|
+
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
30276
|
+
});
|
30277
|
+
});
|
30278
|
+
}));
|
30279
|
+
}
|
30280
|
+
}
|
30281
|
+
});
|
30282
|
+
}());
|
30006
30283
|
(function() {
|
30007
30284
|
$.extend(scrivito, {
|
30008
30285
|
hotkeys: {
|
@@ -30116,7 +30393,7 @@ var scrivito = {};
|
|
30116
30393
|
var child_list = _.map(children, function(child) { return child.obj(); });
|
30117
30394
|
|
30118
30395
|
var view = $(scrivito.template.render('obj_sorting_dialog', {
|
30119
|
-
icon: '
|
30396
|
+
icon: '',
|
30120
30397
|
child_list: child_list
|
30121
30398
|
}));
|
30122
30399
|
|
@@ -30402,6 +30679,7 @@ var scrivito = {};
|
|
30402
30679
|
|
30403
30680
|
|
30404
30681
|
|
30682
|
+
|
30405
30683
|
//
|
30406
30684
|
|
30407
30685
|
|