scrivito_sdk 0.14.0 → 0.15.0
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/default_cms_controller.rb +8 -1
- data/app/helpers/scrivito/cms_tag_helper.rb +1 -0
- data/app/helpers/scrivito/editing_helper.rb +5 -1
- data/config/ca-bundle.crt +1 -1
- data/config/cms_routes.rb +4 -1
- data/lib/assets/javascripts/scrivito_editing.js +394 -327
- data/lib/scrivito/attribute_content.rb +2 -0
- data/lib/scrivito/basic_obj.rb +14 -14
- data/lib/scrivito/basic_widget.rb +11 -0
- data/lib/scrivito/client_config.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8722f05fe458cb8118c945e6339e5c50861e578
|
4
|
+
data.tar.gz: d11c45d1627e15cd80fbd57fd7bbe9998855a4c3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7a0c55860da5ab22465f953c460353e7379b6510000fa6031e1a3d6d008eb5854a15f68c82999352fe37b580a82fb83511d5622199ac6d6e3b92bf38452f8d3
|
7
|
+
data.tar.gz: 54143fff9ba90c9e52ac45c38c7e7baf73be78f4e61b8db6fd9ab03b3b8a2f9bdeb36f5629e71d210759599dcf3dd75ff07ef47860c046976ac404eaa976a583
|
@@ -9,7 +9,7 @@ module Scrivito
|
|
9
9
|
include CmsAccessible
|
10
10
|
|
11
11
|
before_filter :load_object
|
12
|
-
before_filter :authorize_editor, only: [:show_widget, :widget_details]
|
12
|
+
before_filter :authorize_editor, only: [:show_widget, :widget_details, :details_page]
|
13
13
|
|
14
14
|
# Default Action. Delivers files directly if {BasicObj#binary?}.
|
15
15
|
# Otherwise the view is rendered.
|
@@ -29,6 +29,13 @@ module Scrivito
|
|
29
29
|
render template_path, layout: false, locals: {widget: widget}
|
30
30
|
end
|
31
31
|
|
32
|
+
def details_page
|
33
|
+
@scrivito_open_details_page = true
|
34
|
+
@scrivito_binary_id = params[:binary_id]
|
35
|
+
@scrivito_return_to = params[:return_to]
|
36
|
+
render text: '', layout: true
|
37
|
+
end
|
38
|
+
|
32
39
|
# This method indicates if this controller should be used automatically when an Obj is
|
33
40
|
# requested via the Scrivito's standard routes. It returns true by default.
|
34
41
|
#
|
@@ -194,6 +194,7 @@ module Scrivito
|
|
194
194
|
if inplace_editing_allowed?
|
195
195
|
options['data-scrivito-private-widget-id'] = widget.id
|
196
196
|
options['data-scrivito-widget-obj-class'] = widget.obj_class_name
|
197
|
+
options['data-scrivito-private-widget-description-for-editor'] = widget.description_for_editor
|
197
198
|
|
198
199
|
if has_widget_details_view?(widget)
|
199
200
|
options['data-scrivito-private-widget-has-details-view'] = true
|
@@ -19,7 +19,11 @@ module Scrivito
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def scrivito_client_config
|
22
|
-
ClientConfig.new(@obj, cms_editing_context, lookup_context)
|
22
|
+
client_config = ClientConfig.new(@obj, cms_editing_context, lookup_context)
|
23
|
+
if @scrivito_open_details_page
|
24
|
+
client_config.open_resource_dialog(@scrivito_binary_id, @scrivito_return_to);
|
25
|
+
end
|
26
|
+
client_config.to_json.html_safe
|
23
27
|
end
|
24
28
|
end
|
25
29
|
|
data/config/ca-bundle.crt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
##
|
2
2
|
## /mnt/dcc/Scrival_SDK__Kris__117/repos/scrivito/config/ca-bundle.crt -- Bundle of CA Root Certificates
|
3
3
|
##
|
4
|
-
## Converted at: Wed
|
4
|
+
## Converted at: Wed Jun 4 15:54:47 2014 UTC
|
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/cms_routes.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
2
|
root to: 'scrivito/cms_dispatch#index'
|
3
3
|
|
4
|
-
|
4
|
+
get '__scrivito/render_widget/:id/show_widget/:widget_id' => 'scrivito/cms_dispatch#show_widget'
|
5
|
+
get '__scrivito/render_widget/:id/widget_details/:widget_id' => 'scrivito/cms_dispatch#widget_details'
|
6
|
+
|
7
|
+
get '/__scrivito/details_page/:binary_id' => 'scrivito/cms_dispatch#details_page'
|
5
8
|
|
6
9
|
match ':id(/*slug)',
|
7
10
|
to: 'scrivito/cms_dispatch#index',
|
@@ -9682,7 +9682,45 @@ helpers = helpers || Handlebars.helpers; data = data || {};
|
|
9682
9682
|
}).call(this);
|
9683
9683
|
(function() {
|
9684
9684
|
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
9685
|
-
this.ScrivitoHandlebarsTemplates["
|
9685
|
+
this.ScrivitoHandlebarsTemplates["inplace_marker"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
9686
|
+
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
9687
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
9688
|
+
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
9689
|
+
|
9690
|
+
function program1(depth0,data) {
|
9691
|
+
|
9692
|
+
var buffer = "", stack1;
|
9693
|
+
buffer += "\n <span class=\"scrivito_editing_marker_title\">";
|
9694
|
+
if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9695
|
+
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9696
|
+
buffer += escapeExpression(stack1)
|
9697
|
+
+ "</span>\n ";
|
9698
|
+
return buffer;
|
9699
|
+
}
|
9700
|
+
|
9701
|
+
buffer += "<span class=\"scrivito_editing_marker ";
|
9702
|
+
if (stack1 = helpers.css_classes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9703
|
+
else { stack1 = depth0.css_classes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9704
|
+
buffer += escapeExpression(stack1)
|
9705
|
+
+ "\" title=\"";
|
9706
|
+
if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9707
|
+
else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9708
|
+
buffer += escapeExpression(stack1)
|
9709
|
+
+ "\">\n <i class=\"scrivito_icon\">";
|
9710
|
+
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9711
|
+
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9712
|
+
buffer += escapeExpression(stack1)
|
9713
|
+
+ "</i>\n ";
|
9714
|
+
stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
9715
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
9716
|
+
buffer += "\n</span>\n";
|
9717
|
+
return buffer;
|
9718
|
+
});
|
9719
|
+
return this.ScrivitoHandlebarsTemplates["inplace_marker"];
|
9720
|
+
}).call(this);
|
9721
|
+
(function() {
|
9722
|
+
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
9723
|
+
this.ScrivitoHandlebarsTemplates["menu"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
9686
9724
|
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
9687
9725
|
helpers = helpers || Handlebars.helpers; data = data || {};
|
9688
9726
|
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
@@ -9742,59 +9780,13 @@ function program7(depth0,data) {
|
|
9742
9780
|
return escapeExpression(stack1);
|
9743
9781
|
}
|
9744
9782
|
|
9745
|
-
buffer += "<div
|
9746
|
-
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9747
|
-
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9748
|
-
buffer += escapeExpression(stack1)
|
9749
|
-
+ "\" class=\"scrivito_editing_marker_menu\">\n <ul class=\"scrivito_menu_box scrivito_right\">\n ";
|
9783
|
+
buffer += "<div class=\"scrivito_editing_marker_menu\">\n <ul class=\"scrivito_menu_box scrivito_right\">\n ";
|
9750
9784
|
stack1 = helpers.each.call(depth0, depth0.commands, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
9751
9785
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
9752
9786
|
buffer += "\n </ul>\n</div>\n";
|
9753
9787
|
return buffer;
|
9754
9788
|
});
|
9755
|
-
return this.ScrivitoHandlebarsTemplates["
|
9756
|
-
}).call(this);
|
9757
|
-
(function() {
|
9758
|
-
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
9759
|
-
this.ScrivitoHandlebarsTemplates["inplace_menu_marker"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
9760
|
-
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
9761
|
-
helpers = helpers || Handlebars.helpers; data = data || {};
|
9762
|
-
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
9763
|
-
|
9764
|
-
function program1(depth0,data) {
|
9765
|
-
|
9766
|
-
var buffer = "", stack1;
|
9767
|
-
buffer += "\n <span class=\"scrivito_editing_marker_title\">";
|
9768
|
-
if (stack1 = helpers.description) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9769
|
-
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9770
|
-
buffer += escapeExpression(stack1)
|
9771
|
-
+ "</span>\n ";
|
9772
|
-
return buffer;
|
9773
|
-
}
|
9774
|
-
|
9775
|
-
buffer += "<span class=\"scrivito_editing_marker ";
|
9776
|
-
if (stack1 = helpers.css_classes) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9777
|
-
else { stack1 = depth0.css_classes; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9778
|
-
buffer += escapeExpression(stack1)
|
9779
|
-
+ "\" id=\"";
|
9780
|
-
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9781
|
-
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9782
|
-
buffer += escapeExpression(stack1)
|
9783
|
-
+ "\" title=\"";
|
9784
|
-
if (stack1 = helpers.tooltip) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9785
|
-
else { stack1 = depth0.tooltip; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9786
|
-
buffer += escapeExpression(stack1)
|
9787
|
-
+ "\">\n <i class=\"scrivito_icon\">";
|
9788
|
-
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
9789
|
-
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
9790
|
-
buffer += escapeExpression(stack1)
|
9791
|
-
+ "</i>\n ";
|
9792
|
-
stack1 = helpers['if'].call(depth0, depth0.description, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
9793
|
-
if(stack1 || stack1 === 0) { buffer += stack1; }
|
9794
|
-
buffer += "\n</span>\n";
|
9795
|
-
return buffer;
|
9796
|
-
});
|
9797
|
-
return this.ScrivitoHandlebarsTemplates["inplace_menu_marker"];
|
9789
|
+
return this.ScrivitoHandlebarsTemplates["menu"];
|
9798
9790
|
}).call(this);
|
9799
9791
|
(function() {
|
9800
9792
|
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
@@ -9959,7 +9951,7 @@ function program1(depth0,data) {
|
|
9959
9951
|
if(stack1 || stack1 === 0) { buffer += stack1; }
|
9960
9952
|
buffer += "</i>";
|
9961
9953
|
options = {hash:{},data:data};
|
9962
|
-
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "
|
9954
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "inplace_marker.sort_items", options) : helperMissing.call(depth0, "translate", "inplace_marker.sort_items", options)))
|
9963
9955
|
+ "</h3>\n </div>\n\n <div class=\"scrivito_modal_body scrivito_auto_height\">\n <ul id=\"scrivito_obj_sorting_sortable\">\n ";
|
9964
9956
|
stack2 = helpers.each.call(depth0, depth0.child_list, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
9965
9957
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
@@ -10351,7 +10343,10 @@ $.i18n().load({
|
|
10351
10343
|
'commands.sort_items.too_less_children': 'Die Navigation kann nicht sortiert werden, weil sie weniger als zwei Elemente enthält.',
|
10352
10344
|
|
10353
10345
|
'commands.add_widget.title': 'Widget einfügen',
|
10346
|
+
|
10354
10347
|
'commands.widget_details.title': 'Widget-Eigenschaften',
|
10348
|
+
'commands.widget_details.no_details_view': 'Dieses Widget hat keine Eigenschaften',
|
10349
|
+
|
10355
10350
|
'commands.save_widget_to_clipboard.title': 'Widget zum Kopieren markieren',
|
10356
10351
|
|
10357
10352
|
'commands.copy_widget_from_clipboard.title': 'Markiertes Widget hierher kopieren',
|
@@ -10500,7 +10495,10 @@ $.i18n().load({
|
|
10500
10495
|
'commands.sort_items.too_less_children': 'This navigation cannot be sorted because it consists of less than two items.',
|
10501
10496
|
|
10502
10497
|
'commands.add_widget.title': 'Insert widget',
|
10498
|
+
|
10503
10499
|
'commands.widget_details.title': 'Widget properties',
|
10500
|
+
'commands.widget_details.no_details_view': 'This widget has no properties',
|
10501
|
+
|
10504
10502
|
'commands.save_widget_to_clipboard.title': 'Mark widget for copying',
|
10505
10503
|
|
10506
10504
|
'commands.copy_widget_from_clipboard.title': 'Copy marked widget here',
|
@@ -10666,16 +10664,34 @@ var scrivito = {};
|
|
10666
10664
|
|
10667
10665
|
on: function(event, callback) {
|
10668
10666
|
if (event === 'editing') {
|
10667
|
+
scrivito.deprecation_warning('scrivito.on("editing", ...)',
|
10668
|
+
'scrivito.on("load", ...) && scrivito.in_editable_view()');
|
10669
10669
|
scrivito.gui.on('editing', function() {
|
10670
10670
|
if (scrivito.editing_context.visible_workspace.is_editable()) {
|
10671
10671
|
callback();
|
10672
10672
|
}
|
10673
10673
|
});
|
10674
10674
|
} else if (event === 'new_content') {
|
10675
|
+
scrivito.deprecation_warning('scrivito.on("new_content", ...)',
|
10676
|
+
'scrivito.on("content", ...)');
|
10675
10677
|
scrivito.gui.on('new_content', function(dom_element) {
|
10676
|
-
|
10677
|
-
|
10678
|
-
|
10678
|
+
callback(dom_element);
|
10679
|
+
});
|
10680
|
+
} else if (event === 'load') {
|
10681
|
+
scrivito.gui.on('open', function() {
|
10682
|
+
callback();
|
10683
|
+
});
|
10684
|
+
|
10685
|
+
if (scrivito.gui.is_started()) {
|
10686
|
+
callback();
|
10687
|
+
}
|
10688
|
+
} else if (event === 'content') {
|
10689
|
+
scrivito.on('load', function() {
|
10690
|
+
callback(window.document);
|
10691
|
+
});
|
10692
|
+
|
10693
|
+
scrivito.gui.on('content', function(dom_element) {
|
10694
|
+
callback(dom_element);
|
10679
10695
|
});
|
10680
10696
|
} else {
|
10681
10697
|
$.error('Unknown event "' + event + '"');
|
@@ -10710,17 +10726,13 @@ var scrivito = {};
|
|
10710
10726
|
}
|
10711
10727
|
},
|
10712
10728
|
|
10713
|
-
|
10714
|
-
|
10715
|
-
|
10716
|
-
|
10717
|
-
id: obj_id
|
10718
|
-
});
|
10719
|
-
var fetch_markup = function() {
|
10720
|
-
return obj.fetch_details_markup();
|
10721
|
-
};
|
10729
|
+
in_editable_view: function() {
|
10730
|
+
return scrivito.editing_context.display_mode === 'editing' &&
|
10731
|
+
scrivito.editing_context.visible_workspace.is_editable();
|
10732
|
+
},
|
10722
10733
|
|
10723
|
-
|
10734
|
+
open_resource_dialog: function(obj_id) {
|
10735
|
+
return scrivito.resource_dialog.open(obj_id);
|
10724
10736
|
},
|
10725
10737
|
|
10726
10738
|
init: function(config) {
|
@@ -10729,8 +10741,9 @@ var scrivito = {};
|
|
10729
10741
|
scrivito.editing_context.init(config.editing_context);
|
10730
10742
|
scrivito.i18n.init(config.i18n);
|
10731
10743
|
scrivito.obj.init(config.obj);
|
10744
|
+
scrivito.resource_dialog.init(config.open_resource_dialog);
|
10732
10745
|
|
10733
|
-
scrivito.
|
10746
|
+
scrivito.inplace_marker.init();
|
10734
10747
|
scrivito.menu_bar_saving_indicator.init();
|
10735
10748
|
scrivito.menu_bar_toggle.init();
|
10736
10749
|
scrivito.menu_bar_dropdown.init();
|
@@ -10876,16 +10889,22 @@ var scrivito = {};
|
|
10876
10889
|
}
|
10877
10890
|
});
|
10878
10891
|
}
|
10892
|
+
|
10893
|
+
if (callbacks.content) {
|
10894
|
+
_.each(callbacks.content, function(callback) {
|
10895
|
+
if (dom_element) {
|
10896
|
+
callback(dom_element);
|
10897
|
+
}
|
10898
|
+
});
|
10899
|
+
}
|
10879
10900
|
};
|
10880
10901
|
|
10881
10902
|
$.extend(scrivito, {
|
10882
10903
|
gui: {
|
10883
10904
|
start: function() {
|
10884
10905
|
$('body').attr('data-scrivito-display-mode', scrivito.editing_context.display_mode);
|
10885
|
-
|
10886
|
-
run_open_callbacks();
|
10887
|
-
|
10888
10906
|
$('body').append('<div id="ip-editing"></div>');
|
10907
|
+
run_open_callbacks();
|
10889
10908
|
},
|
10890
10909
|
|
10891
10910
|
new_content: function(dom_element) {
|
@@ -10903,6 +10922,10 @@ var scrivito = {};
|
|
10903
10922
|
// for testing purposes only
|
10904
10923
|
reset_callbacks: function() {
|
10905
10924
|
callbacks = {};
|
10925
|
+
},
|
10926
|
+
|
10927
|
+
is_started: function() {
|
10928
|
+
return !!$('body').attr('data-scrivito-display-mode');
|
10906
10929
|
}
|
10907
10930
|
}
|
10908
10931
|
});
|
@@ -11591,18 +11614,7 @@ var scrivito = {};
|
|
11591
11614
|
'data-scrivito-private-changes-list-obj-modification');
|
11592
11615
|
var obj_is_binary = element.attr('data-scrivito-private-changes-list-obj-is-binary');
|
11593
11616
|
|
11594
|
-
|
11595
|
-
scrivito.open_resource_dialog(obj_id);
|
11596
|
-
} else {
|
11597
|
-
if (obj_modification === 'deleted') {
|
11598
|
-
scrivito.change_location('/' + obj_id + '?_scrivito_display_mode=deleted');
|
11599
|
-
} else if (obj_modification === 'new' &&
|
11600
|
-
scrivito.editing_context.is_deleted_mode()) {
|
11601
|
-
scrivito.change_location('/' + obj_id + '?_scrivito_display_mode=added');
|
11602
|
-
} else {
|
11603
|
-
scrivito.change_location('/' + obj_id);
|
11604
|
-
}
|
11605
|
-
}
|
11617
|
+
scrivito.changes_dialog.redirect_to_obj(obj_id, obj_modification, obj_is_binary);
|
11606
11618
|
return false;
|
11607
11619
|
});
|
11608
11620
|
});
|
@@ -11629,6 +11641,26 @@ var scrivito = {};
|
|
11629
11641
|
});
|
11630
11642
|
|
11631
11643
|
return scrivito.with_dialog_behaviour(deferred, {escape: cancel});
|
11644
|
+
},
|
11645
|
+
|
11646
|
+
redirect_to_obj: function(obj_id, modification, is_binary) {
|
11647
|
+
var base_url = '/';
|
11648
|
+
var query_params = {};
|
11649
|
+
|
11650
|
+
if (!!is_binary) {
|
11651
|
+
base_url = '/__scrivito/details_page/';
|
11652
|
+
query_params.return_to = document.URL;
|
11653
|
+
}
|
11654
|
+
|
11655
|
+
if (modification === 'deleted' && !scrivito.editing_context.is_deleted_mode()) {
|
11656
|
+
query_params._scrivito_display_mode = 'deleted';
|
11657
|
+
}
|
11658
|
+
|
11659
|
+
if (modification === 'new' && scrivito.editing_context.is_deleted_mode()) {
|
11660
|
+
query_params._scrivito_display_mode = 'added';
|
11661
|
+
}
|
11662
|
+
|
11663
|
+
scrivito.change_location(base_url + obj_id + '?' + $.param( query_params ));
|
11632
11664
|
}
|
11633
11665
|
}
|
11634
11666
|
});
|
@@ -11869,6 +11901,19 @@ $(function() {
|
|
11869
11901
|
|
11870
11902
|
equals: function(cms_element) {
|
11871
11903
|
return cms_element.dom_element().get(0) === that.dom_element().get(0);
|
11904
|
+
},
|
11905
|
+
|
11906
|
+
menu: function() {
|
11907
|
+
var menu = dom_element.data('scrivito-menu');
|
11908
|
+
if (!menu) {
|
11909
|
+
menu = [];
|
11910
|
+
that.set_menu(menu);
|
11911
|
+
}
|
11912
|
+
return menu;
|
11913
|
+
},
|
11914
|
+
|
11915
|
+
set_menu: function(menu) {
|
11916
|
+
dom_element.data('scrivito-menu', menu);
|
11872
11917
|
}
|
11873
11918
|
};
|
11874
11919
|
|
@@ -12518,6 +12563,10 @@ $(function() {
|
|
12518
12563
|
return options.container_modification;
|
12519
12564
|
},
|
12520
12565
|
|
12566
|
+
description_for_editor: function() {
|
12567
|
+
return options.description_for_editor;
|
12568
|
+
},
|
12569
|
+
|
12521
12570
|
is_modified: function() {
|
12522
12571
|
return !!(that.modification() || that.container_modification());
|
12523
12572
|
},
|
@@ -12569,13 +12618,16 @@ $(function() {
|
|
12569
12618
|
|
12570
12619
|
$.extend(that, {
|
12571
12620
|
widget: function() {
|
12621
|
+
var dom_element = that.dom_element();
|
12572
12622
|
return scrivito.widget.create_instance(that.widget_field().obj(),
|
12573
|
-
|
12574
|
-
|
12623
|
+
dom_element.attr('data-scrivito-private-widget-id'),
|
12624
|
+
dom_element.attr('data-scrivito-widget-obj-class'),
|
12575
12625
|
{
|
12576
|
-
modification:
|
12577
|
-
container_modification:
|
12578
|
-
'data-scrivito-private-widget-container-modification')
|
12626
|
+
modification: dom_element.attr('data-scrivito-private-widget-modification'),
|
12627
|
+
container_modification: dom_element.attr(
|
12628
|
+
'data-scrivito-private-widget-container-modification'),
|
12629
|
+
description_for_editor: dom_element.attr(
|
12630
|
+
'data-scrivito-private-widget-description-for-editor')
|
12579
12631
|
}
|
12580
12632
|
);
|
12581
12633
|
},
|
@@ -12624,7 +12676,8 @@ $(function() {
|
|
12624
12676
|
},
|
12625
12677
|
|
12626
12678
|
widget_elements: function() {
|
12627
|
-
var widget_elements_dom = that.dom_element()
|
12679
|
+
var widget_elements_dom = that.dom_element()
|
12680
|
+
.children('[data-scrivito-private-widget-id]');
|
12628
12681
|
var widget_elements = _.map(widget_elements_dom, function(widget_element_dom) {
|
12629
12682
|
return scrivito.cms_element.from_dom_element($(widget_element_dom));
|
12630
12683
|
});
|
@@ -12681,7 +12734,8 @@ $(function() {
|
|
12681
12734
|
var add_widget = function(widget_spec, widget_element) {
|
12682
12735
|
var position;
|
12683
12736
|
if (widget_element) {
|
12684
|
-
position = widget_element.dom_element()
|
12737
|
+
position = widget_element.dom_element()
|
12738
|
+
.prevAll('[data-scrivito-private-widget-id]').length + 1;
|
12685
12739
|
} else {
|
12686
12740
|
position = that.widget_elements().length;
|
12687
12741
|
}
|
@@ -13364,11 +13418,17 @@ $(function() {
|
|
13364
13418
|
|
13365
13419
|
fetch_markup().then(function(markup) {
|
13366
13420
|
target.html(markup);
|
13367
|
-
|
13368
|
-
var
|
13369
|
-
|
13421
|
+
|
13422
|
+
var size_attr = 'data-scrivito-modal-size';
|
13423
|
+
var modal_size = $(markup).attr(size_attr) ||
|
13424
|
+
$(markup).find('[' + size_attr + ']').attr(size_attr);
|
13425
|
+
if (_.contains(['small', 'medium', 'large'], modal_size)) {
|
13370
13426
|
view.removeClass('scrivito_modal_medium');
|
13371
|
-
|
13427
|
+
scrivito.transition(view, function() {
|
13428
|
+
view.addClass('scrivito_modal_' + modal_size);
|
13429
|
+
}).then(function() {
|
13430
|
+
scrivito.dialog.adjust(view);
|
13431
|
+
});
|
13372
13432
|
}
|
13373
13433
|
|
13374
13434
|
spinner.hide();
|
@@ -13412,180 +13472,158 @@ $(function() {
|
|
13412
13472
|
});
|
13413
13473
|
}());
|
13414
13474
|
(function() {
|
13415
|
-
var menu_define_callbacks = [];
|
13416
|
-
var dom_elements_with_menus = [];
|
13417
|
-
var dom_elements_with_marker = [];
|
13418
|
-
var fade_time = 500;
|
13419
|
-
|
13420
13475
|
$.extend(scrivito, {
|
13421
|
-
|
13422
|
-
|
13423
|
-
|
13424
|
-
},
|
13476
|
+
menus: {
|
13477
|
+
open: function(dom_element, commands) {
|
13478
|
+
scrivito.menus.close_all();
|
13425
13479
|
|
13426
|
-
|
13427
|
-
_.each($('.scrivito_editing_marker_menu'), function(menu_dom) {
|
13428
|
-
var menu = $(menu_dom);
|
13429
|
-
var marker = $('#' + menu.data('scrivito-private-menu-marker-id'));
|
13430
|
-
menu.offset(marker.offset());
|
13431
|
-
});
|
13432
|
-
},
|
13480
|
+
var menu = $(scrivito.template.render('menu', {commands: commands}));
|
13433
13481
|
|
13434
|
-
|
13435
|
-
|
13436
|
-
},
|
13482
|
+
menu.data('scrivito-private-menus-target', dom_element);
|
13483
|
+
dom_element.data('scrivito-private-menus-menu', menu);
|
13437
13484
|
|
13438
|
-
|
13439
|
-
|
13440
|
-
|
13441
|
-
|
13442
|
-
|
13443
|
-
|
13444
|
-
|
13485
|
+
_.each(commands, function(command) {
|
13486
|
+
menu.find('.scrivito_menu_item.' + command.id()).on('click', function() {
|
13487
|
+
if (command.is_enabled()) {
|
13488
|
+
close(menu);
|
13489
|
+
}
|
13490
|
+
command.execute();
|
13491
|
+
return false;
|
13492
|
+
});
|
13445
13493
|
});
|
13446
|
-
},
|
13447
13494
|
|
13448
|
-
|
13449
|
-
|
13495
|
+
menu.appendTo($('body'));
|
13496
|
+
menu.offset(dom_element.offset()); // Bugfix IE: offset can not be set before append.
|
13497
|
+
menu.find('.scrivito_menu_box').fadeIn(500);
|
13450
13498
|
},
|
13451
13499
|
|
13452
|
-
|
13453
|
-
|
13454
|
-
|
13455
|
-
|
13456
|
-
|
13457
|
-
scrivito.
|
13500
|
+
toggle: function(dom_element, commands) {
|
13501
|
+
var menu = dom_element.data('scrivito-private-menus-menu');
|
13502
|
+
if (menu) {
|
13503
|
+
close(menu);
|
13504
|
+
} else {
|
13505
|
+
scrivito.menus.open(dom_element, commands);
|
13458
13506
|
}
|
13459
|
-
}
|
13460
|
-
}
|
13461
|
-
});
|
13462
|
-
|
13463
|
-
var collect_menu_items = function() {
|
13464
|
-
var menu = {
|
13465
|
-
add_item: function(dom_element, command) {
|
13466
|
-
dom_element = $(dom_element);
|
13467
|
-
var commands = dom_element.data('scrivito-private-menu-commands') || [];
|
13468
|
-
commands.push(command);
|
13469
|
-
dom_elements_with_menus.push(dom_element);
|
13470
|
-
if (command.is_present()) {
|
13471
|
-
dom_elements_with_marker.push(dom_element);
|
13472
|
-
}
|
13473
|
-
dom_element.data('scrivito-private-menu-commands', commands);
|
13474
|
-
},
|
13475
|
-
|
13476
|
-
set_icon: function(dom_element, icon) {
|
13477
|
-
$(dom_element).attr('data-scrivito-private-menu-icon', icon);
|
13478
13507
|
},
|
13479
13508
|
|
13480
|
-
|
13481
|
-
|
13482
|
-
|
13483
|
-
|
13484
|
-
set_tooltip: function(dom_element, tooltip) {
|
13485
|
-
$(dom_element).attr('data-scrivito-private-menu-tooltip', tooltip);
|
13509
|
+
close_all: function() {
|
13510
|
+
each_menu(function(menu) {
|
13511
|
+
close(menu);
|
13512
|
+
});
|
13486
13513
|
},
|
13487
13514
|
|
13488
|
-
|
13489
|
-
|
13515
|
+
refresh_positions: function() {
|
13516
|
+
each_menu(function(menu) {
|
13517
|
+
menu.offset(menu.data('scrivito-private-menus-target').offset());
|
13518
|
+
});
|
13490
13519
|
}
|
13491
|
-
}
|
13520
|
+
}
|
13521
|
+
});
|
13492
13522
|
|
13493
|
-
|
13494
|
-
|
13523
|
+
var each_menu = function(callback) {
|
13524
|
+
_.each($('.scrivito_editing_marker_menu'), function(menu) {
|
13525
|
+
callback($(menu));
|
13495
13526
|
});
|
13496
13527
|
};
|
13497
13528
|
|
13498
|
-
var
|
13499
|
-
menus.
|
13500
|
-
|
13529
|
+
var close = function(menu) {
|
13530
|
+
menu.data('scrivito-private-menus-target').removeData('scrivito-private-menus-menu');
|
13531
|
+
menu.fadeOut(500, function() {
|
13532
|
+
menu.remove();
|
13501
13533
|
});
|
13502
13534
|
};
|
13535
|
+
}());
|
13503
13536
|
|
13504
|
-
|
13505
|
-
|
13506
|
-
|
13507
|
-
var menu_id = 'scrivito_private_menu_' + i;
|
13508
|
-
var marker_id = 'scrivito_private_menu_marker_' + i;
|
13509
|
-
|
13510
|
-
var icon = dom_element.attr('data-scrivito-private-menu-icon') || '\uf000';
|
13511
|
-
var description = dom_element.attr('data-scrivito-private-menu-description');
|
13512
|
-
var tooltip = dom_element.attr('data-scrivito-private-menu-tooltip');
|
13513
|
-
var css_classes = dom_element.attr('data-scrivito-private-menu-css-classes');
|
13514
|
-
var commands = dom_element.data('scrivito-private-menu-commands');
|
13515
|
-
|
13516
|
-
var marker = $(scrivito.template.render('inplace_menu_marker', {
|
13517
|
-
id: marker_id,
|
13518
|
-
icon: icon,
|
13519
|
-
description: description,
|
13520
|
-
tooltip: tooltip,
|
13521
|
-
css_classes: css_classes
|
13522
|
-
}));
|
13523
|
-
|
13524
|
-
marker.data('scrivito-private-menu-id', marker_id);
|
13537
|
+
$(window).on('resize', function() {
|
13538
|
+
scrivito.menus.refresh_positions();
|
13539
|
+
});
|
13525
13540
|
|
13526
|
-
|
13527
|
-
|
13541
|
+
$(window).on('load', function() {
|
13542
|
+
scrivito.menus.refresh_positions();
|
13543
|
+
});
|
13544
|
+
(function() {
|
13545
|
+
var callbacks = [];
|
13528
13546
|
|
13529
|
-
|
13547
|
+
$.extend(scrivito, {
|
13548
|
+
inplace_marker: {
|
13549
|
+
init: function() {
|
13550
|
+
scrivito.on('load', function() {
|
13551
|
+
scrivito.inplace_marker.refresh();
|
13552
|
+
});
|
13553
|
+
scrivito.on('content', function() {
|
13554
|
+
scrivito.inplace_marker.refresh();
|
13555
|
+
});
|
13556
|
+
},
|
13530
13557
|
|
13531
|
-
|
13532
|
-
|
13533
|
-
|
13558
|
+
define: function(callback) {
|
13559
|
+
callbacks.push(callback);
|
13560
|
+
},
|
13534
13561
|
|
13535
|
-
|
13536
|
-
|
13562
|
+
refresh: function() {
|
13563
|
+
if (!scrivito.editing_context.is_view_mode()) {
|
13564
|
+
$('.scrivito_editing_marker').remove();
|
13537
13565
|
|
13538
|
-
|
13566
|
+
_.each(callbacks, function(callback) {
|
13567
|
+
callback(builder);
|
13568
|
+
});
|
13539
13569
|
|
13540
|
-
|
13541
|
-
|
13542
|
-
|
13543
|
-
remove_menu();
|
13544
|
-
}
|
13545
|
-
command.execute();
|
13546
|
-
return false;
|
13547
|
-
});
|
13548
|
-
});
|
13570
|
+
scrivito.menus.refresh_positions();
|
13571
|
+
}
|
13572
|
+
},
|
13549
13573
|
|
13550
|
-
|
13574
|
+
// For test purpose only.
|
13575
|
+
reset_callbacks: function() {
|
13576
|
+
callbacks = [];
|
13577
|
+
}
|
13578
|
+
}
|
13579
|
+
});
|
13551
13580
|
|
13552
|
-
|
13581
|
+
var builder = {
|
13582
|
+
activate_for: function(cms_element, options) {
|
13583
|
+
var marker = $(scrivito.template.render('inplace_marker',
|
13584
|
+
$.extend({icon: '\uf000'}, options || {})));
|
13553
13585
|
|
13554
|
-
|
13555
|
-
|
13556
|
-
|
13557
|
-
|
13558
|
-
remove_menu();
|
13559
|
-
}
|
13560
|
-
});
|
13586
|
+
marker.on('click', function() {
|
13587
|
+
scrivito.menus.toggle(marker, cms_element.menu());
|
13588
|
+
return false;
|
13589
|
+
});
|
13561
13590
|
|
13562
|
-
|
13563
|
-
|
13564
|
-
});
|
13591
|
+
marker.prependTo(cms_element.dom_element());
|
13592
|
+
}
|
13565
13593
|
};
|
13594
|
+
}());
|
13595
|
+
(function() {
|
13596
|
+
$.extend(scrivito, {
|
13597
|
+
resource_dialog: {
|
13598
|
+
init: function(config) {
|
13599
|
+
if (config) {
|
13600
|
+
scrivito.gui.on('open', function() {
|
13601
|
+
scrivito.resource_dialog.open_and_redirect_on_close(config.obj_id, config.redirect_to);
|
13602
|
+
});
|
13603
|
+
}
|
13604
|
+
},
|
13566
13605
|
|
13567
|
-
|
13568
|
-
|
13569
|
-
remove_menus();
|
13570
|
-
};
|
13606
|
+
open: function(obj_id) {
|
13607
|
+
var title = scrivito.i18n.translate('resource');
|
13571
13608
|
|
13572
|
-
|
13573
|
-
|
13574
|
-
|
13575
|
-
|
13576
|
-
|
13577
|
-
|
13578
|
-
dom_elements_with_marker = [];
|
13579
|
-
};
|
13580
|
-
}());
|
13609
|
+
var obj = scrivito.obj.create_instance({
|
13610
|
+
id: obj_id
|
13611
|
+
});
|
13612
|
+
var fetch_markup = function() {
|
13613
|
+
return obj.fetch_details_markup();
|
13614
|
+
};
|
13581
13615
|
|
13582
|
-
|
13583
|
-
|
13584
|
-
});
|
13616
|
+
return scrivito.details_dialog.open(title, fetch_markup, '');
|
13617
|
+
},
|
13585
13618
|
|
13586
|
-
|
13587
|
-
|
13588
|
-
|
13619
|
+
open_and_redirect_on_close: function(obj_id, redirect_to) {
|
13620
|
+
scrivito.resource_dialog.open(obj_id).done(function() {
|
13621
|
+
return scrivito.redirect_to(redirect_to);
|
13622
|
+
});
|
13623
|
+
}
|
13624
|
+
}
|
13625
|
+
});
|
13626
|
+
}());
|
13589
13627
|
(function() {
|
13590
13628
|
$.extend(scrivito, {
|
13591
13629
|
add_subpage_command: function(child_list_element) {
|
@@ -13631,11 +13669,13 @@ $(window).on('load', function() {
|
|
13631
13669
|
|
13632
13670
|
execute: function() {
|
13633
13671
|
var selection = widget_field_element.fetch_widget_class_selection();
|
13634
|
-
|
13672
|
+
var choose_widget_obj_class = scrivito.choose_obj_class_dialog(selection, 'add_widget');
|
13673
|
+
return choose_widget_obj_class.then(function(obj_class) {
|
13635
13674
|
return scrivito.with_saving_overlay(
|
13636
13675
|
widget_field_element.create_widget(obj_class, widget_element).then(function(widget) {
|
13637
13676
|
return widget.fetch_show_markup().then(function(widget_markup) {
|
13638
|
-
var dom_element = widget_field_element
|
13677
|
+
var dom_element = widget_field_element
|
13678
|
+
.append_widget_markup(widget_markup, widget_element);
|
13639
13679
|
scrivito.ensure_fully_visible_within_window(dom_element);
|
13640
13680
|
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
13641
13681
|
});
|
@@ -13713,10 +13753,11 @@ $(window).on('load', function() {
|
|
13713
13753
|
var copy_widget = widget_field_element.copy_widget(obj_id, widget_id, widget_element);
|
13714
13754
|
return scrivito.with_saving_overlay(copy_widget.then(function(widget) {
|
13715
13755
|
return widget.fetch_show_markup().then(function(widget_markup) {
|
13716
|
-
var dom_element = widget_field_element
|
13756
|
+
var dom_element = widget_field_element
|
13757
|
+
.append_widget_markup(widget_markup, widget_element);
|
13717
13758
|
scrivito.ensure_fully_visible_within_window(dom_element);
|
13718
13759
|
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
13719
|
-
scrivito.
|
13760
|
+
scrivito.inplace_marker.refresh();
|
13720
13761
|
});
|
13721
13762
|
}));
|
13722
13763
|
}
|
@@ -13755,6 +13796,10 @@ $(window).on('load', function() {
|
|
13755
13796
|
confirm_button_color: 'red'
|
13756
13797
|
}).then(function() {
|
13757
13798
|
return scrivito.with_saving_overlay(obj.destroy().then(function() {
|
13799
|
+
if (scrivito.obj_clipboard.is_present() &&
|
13800
|
+
scrivito.obj_clipboard.obj().id() === obj.id()) {
|
13801
|
+
scrivito.obj_clipboard.clear();
|
13802
|
+
}
|
13758
13803
|
return scrivito.redirect_to('/');
|
13759
13804
|
}));
|
13760
13805
|
});
|
@@ -13788,13 +13833,18 @@ $(window).on('load', function() {
|
|
13788
13833
|
widget_element.dom_element().remove();
|
13789
13834
|
|
13790
13835
|
if (widget_field_element.widget_elements().length === 0) {
|
13791
|
-
scrivito.
|
13836
|
+
scrivito.inplace_marker.refresh();
|
13792
13837
|
}
|
13793
13838
|
|
13794
13839
|
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
13795
13840
|
|
13796
13841
|
return widget_field_element.save().then(function() {
|
13797
|
-
return widget.destroy()
|
13842
|
+
return widget.destroy().then(function() {
|
13843
|
+
if (scrivito.widget_clipboard.is_present() &&
|
13844
|
+
scrivito.widget_clipboard.widget().id() === widget.id()) {
|
13845
|
+
scrivito.widget_clipboard.clear();
|
13846
|
+
}
|
13847
|
+
});
|
13798
13848
|
});
|
13799
13849
|
});
|
13800
13850
|
}
|
@@ -14013,7 +14063,6 @@ $(window).on('load', function() {
|
|
14013
14063
|
|
14014
14064
|
execute: function() {
|
14015
14065
|
scrivito.obj_clipboard.save_obj(obj);
|
14016
|
-
scrivito.inplace_menus.refresh();
|
14017
14066
|
}
|
14018
14067
|
});
|
14019
14068
|
}
|
@@ -14033,7 +14082,6 @@ $(window).on('load', function() {
|
|
14033
14082
|
|
14034
14083
|
execute: function() {
|
14035
14084
|
scrivito.widget_clipboard.save_widget(widget_element.widget());
|
14036
|
-
scrivito.inplace_menus.refresh();
|
14037
14085
|
}
|
14038
14086
|
});
|
14039
14087
|
}
|
@@ -14081,8 +14129,14 @@ $(window).on('load', function() {
|
|
14081
14129
|
icon: '',
|
14082
14130
|
|
14083
14131
|
present: function() {
|
14084
|
-
return
|
14085
|
-
|
14132
|
+
return scrivito.editing_context.is_editing_mode() ||
|
14133
|
+
widget_element.widget().is_modified();
|
14134
|
+
},
|
14135
|
+
|
14136
|
+
disabled: function() {
|
14137
|
+
if (!widget_element.has_details_view()) {
|
14138
|
+
return scrivito.i18n.translate('commands.widget_details.no_details_view');
|
14139
|
+
}
|
14086
14140
|
},
|
14087
14141
|
|
14088
14142
|
execute: function() {
|
@@ -14105,41 +14159,34 @@ $(window).on('load', function() {
|
|
14105
14159
|
$.extend(scrivito, {
|
14106
14160
|
widget_menus: {
|
14107
14161
|
init: function() {
|
14108
|
-
scrivito.
|
14162
|
+
scrivito.inplace_marker.define(function(inplace_marker) {
|
14109
14163
|
if (scrivito.editing_context.selected_workspace.is_editable()) {
|
14110
14164
|
_.each(scrivito.widget_field_element.all(), function(widget_field_element) {
|
14111
|
-
|
14112
|
-
_.each([
|
14165
|
+
widget_field_element.set_menu([
|
14113
14166
|
scrivito.add_widget_command(widget_field_element),
|
14114
14167
|
scrivito.copy_widget_from_clipboard_command(widget_field_element)
|
14115
|
-
]
|
14116
|
-
|
14117
|
-
|
14168
|
+
]);
|
14169
|
+
|
14170
|
+
if (scrivito.editing_context.is_editing_mode() &&
|
14171
|
+
widget_field_element.widget_elements().length === 0) {
|
14172
|
+
inplace_marker.activate_for(widget_field_element);
|
14173
|
+
}
|
14118
14174
|
|
14119
14175
|
_.each(widget_field_element.widget_elements(), function(widget_element) {
|
14120
|
-
|
14121
|
-
_.each([
|
14176
|
+
widget_element.set_menu([
|
14122
14177
|
scrivito.add_widget_command(widget_field_element, widget_element),
|
14123
14178
|
scrivito.widget_details_command(widget_element),
|
14124
14179
|
scrivito.save_widget_to_clipboard_command(widget_element),
|
14125
14180
|
scrivito.copy_widget_from_clipboard_command(widget_field_element, widget_element),
|
14126
14181
|
scrivito.delete_widget_command(widget_field_element, widget_element)
|
14127
|
-
]
|
14128
|
-
|
14129
|
-
|
14130
|
-
|
14131
|
-
|
14132
|
-
|
14133
|
-
|
14134
|
-
|
14135
|
-
scrivito.editing_context.is_comparing_mode()) {
|
14136
|
-
var options = menu_options(widget_element);
|
14137
|
-
if (options) {
|
14138
|
-
var tooltip = scrivito.i18n.translate('widget_menus.' + options.key);
|
14139
|
-
menu.set_tooltip(widget_dom_element, tooltip);
|
14140
|
-
menu.set_icon(widget_dom_element, options.icon);
|
14141
|
-
menu.set_css_classes(widget_dom_element, options.css_class);
|
14142
|
-
}
|
14182
|
+
]);
|
14183
|
+
|
14184
|
+
var modification = widget_element.widget().modification() ||
|
14185
|
+
widget_element.widget().container_modification();
|
14186
|
+
if (scrivito.editing_context.is_editing_mode() ||
|
14187
|
+
scrivito.editing_context.is_comparing_mode() && !!modification) {
|
14188
|
+
inplace_marker.activate_for(widget_element,
|
14189
|
+
inplace_marker_options(widget_element));
|
14143
14190
|
}
|
14144
14191
|
});
|
14145
14192
|
});
|
@@ -14149,69 +14196,81 @@ $(window).on('load', function() {
|
|
14149
14196
|
}
|
14150
14197
|
});
|
14151
14198
|
|
14152
|
-
var
|
14153
|
-
var
|
14154
|
-
|
14155
|
-
|
14156
|
-
|
14157
|
-
|
14158
|
-
|
14159
|
-
|
14160
|
-
|
14161
|
-
|
14162
|
-
|
14163
|
-
|
14164
|
-
|
14165
|
-
|
14166
|
-
|
14167
|
-
|
14168
|
-
|
14169
|
-
|
14170
|
-
|
14171
|
-
|
14172
|
-
|
14173
|
-
|
14174
|
-
|
14175
|
-
|
14176
|
-
|
14177
|
-
|
14178
|
-
|
14179
|
-
|
14180
|
-
|
14181
|
-
|
14182
|
-
|
14183
|
-
|
14184
|
-
|
14185
|
-
|
14186
|
-
|
14187
|
-
|
14188
|
-
|
14199
|
+
var inplace_marker_options = function(widget_element) {
|
14200
|
+
var options = {};
|
14201
|
+
|
14202
|
+
if (scrivito.editing_context.is_comparing_mode()) {
|
14203
|
+
var tooltip_translation_key;
|
14204
|
+
var modification = widget_element.widget().modification();
|
14205
|
+
var container_modification = widget_element.widget().container_modification();
|
14206
|
+
|
14207
|
+
switch (modification) {
|
14208
|
+
case 'new':
|
14209
|
+
tooltip_translation_key = 'widget_is_new';
|
14210
|
+
options.icon = '\uf022';
|
14211
|
+
break;
|
14212
|
+
case 'deleted':
|
14213
|
+
tooltip_translation_key = 'widget_is_deleted';
|
14214
|
+
options.icon = '\uf018';
|
14215
|
+
break;
|
14216
|
+
case 'edited':
|
14217
|
+
options.icon = '\uf035';
|
14218
|
+
switch (container_modification) {
|
14219
|
+
case 'new':
|
14220
|
+
tooltip_translation_key = 'widget_is_edited_and_dragged_here';
|
14221
|
+
options.css_classes = 'scrivito_widget_moved_icon';
|
14222
|
+
break;
|
14223
|
+
case 'deleted':
|
14224
|
+
tooltip_translation_key = 'widget_is_edited_and_dragged_away';
|
14225
|
+
options.css_classes = 'scrivito_widget_moved_icon';
|
14226
|
+
break;
|
14227
|
+
default:
|
14228
|
+
tooltip_translation_key = 'widget_is_edited';
|
14229
|
+
}
|
14230
|
+
break;
|
14231
|
+
default:
|
14232
|
+
options.icon = '\uf03c';
|
14233
|
+
switch (container_modification) {
|
14234
|
+
case 'new':
|
14235
|
+
tooltip_translation_key = 'widget_is_dragged_here';
|
14236
|
+
break;
|
14237
|
+
case 'deleted':
|
14238
|
+
tooltip_translation_key = 'widget_is_dragged_away';
|
14239
|
+
break;
|
14240
|
+
}
|
14241
|
+
}
|
14242
|
+
|
14243
|
+
if (tooltip_translation_key) {
|
14244
|
+
options.tooltip = scrivito.i18n.translate('widget_menus.' + tooltip_translation_key);
|
14245
|
+
}
|
14189
14246
|
}
|
14247
|
+
|
14248
|
+
options.description = widget_element.widget().description_for_editor();
|
14249
|
+
|
14250
|
+
return options;
|
14190
14251
|
};
|
14191
14252
|
}());
|
14192
14253
|
(function() {
|
14193
14254
|
$.extend(scrivito, {
|
14194
14255
|
widget_reloading: {
|
14195
14256
|
init: function() {
|
14196
|
-
|
14257
|
+
scrivito.on('content', function(dom_element) {
|
14258
|
+
if (scrivito.in_editable_view()) {
|
14259
|
+
var jquery_object = $(dom_element);
|
14260
|
+
|
14261
|
+
if (jquery_object.attr('data-scrivito-private-widget-id')) {
|
14262
|
+
activate_for(jquery_object);
|
14263
|
+
}
|
14197
14264
|
|
14198
|
-
|
14199
|
-
|
14200
|
-
|
14201
|
-
activate_for(jquery_object);
|
14265
|
+
_.each(jquery_object.find('[data-scrivito-private-widget-id]'), function(dom_element) {
|
14266
|
+
activate_for($(dom_element));
|
14267
|
+
});
|
14202
14268
|
}
|
14203
|
-
activate_for_all_beneath(jquery_object);
|
14204
14269
|
});
|
14205
14270
|
}
|
14206
14271
|
}
|
14207
14272
|
});
|
14208
14273
|
|
14209
|
-
var activate_for_all_beneath = function(jquery_object) {
|
14210
|
-
_.each(jquery_object.find('[data-scrivito-private-widget-id]'), function(dom_element) {
|
14211
|
-
activate_for($(dom_element));
|
14212
|
-
});
|
14213
|
-
};
|
14214
|
-
|
14215
14274
|
var activate_for = function(jquery_object) {
|
14216
14275
|
jquery_object.on('scrivito_reload', function() {
|
14217
14276
|
var widget_element = scrivito.cms_element.from_dom_element(jquery_object);
|
@@ -14232,15 +14291,21 @@ $(window).on('load', function() {
|
|
14232
14291
|
$.extend(scrivito, {
|
14233
14292
|
widget_sorting: {
|
14234
14293
|
init: function() {
|
14235
|
-
scrivito.
|
14236
|
-
|
14294
|
+
scrivito.on('load', function() {
|
14295
|
+
if (scrivito.in_editable_view()) {
|
14296
|
+
create();
|
14297
|
+
}
|
14298
|
+
});
|
14299
|
+
scrivito.on('content', function() {
|
14300
|
+
create();
|
14301
|
+
});
|
14237
14302
|
},
|
14238
14303
|
|
14239
14304
|
start: function(event, ui) {
|
14240
14305
|
$('body').addClass('scrivito_widget_dragging_active');
|
14241
14306
|
|
14242
14307
|
var marker = ui.item.find('.scrivito_editing_marker');
|
14243
|
-
scrivito.
|
14308
|
+
scrivito.menus.close_all();
|
14244
14309
|
|
14245
14310
|
var widget_element = scrivito.cms_element.from_dom_element(ui.item);
|
14246
14311
|
var widget_class_name = widget_element.widget().widget_class_name();
|
@@ -14260,7 +14325,7 @@ $(window).on('load', function() {
|
|
14260
14325
|
stop: function() {
|
14261
14326
|
$('body').removeClass('scrivito_widget_dragging_active');
|
14262
14327
|
|
14263
|
-
scrivito.
|
14328
|
+
scrivito.inplace_marker.refresh();
|
14264
14329
|
|
14265
14330
|
_.each(widget_field_dom_elements, function(dom_element) {
|
14266
14331
|
dom_element.removeClass('scrivito_widget_drop_allowed');
|
@@ -14352,22 +14417,20 @@ $(window).on('load', function() {
|
|
14352
14417
|
$.extend(scrivito, {
|
14353
14418
|
child_list_menus: {
|
14354
14419
|
init: function() {
|
14355
|
-
scrivito.
|
14420
|
+
scrivito.inplace_marker.define(function(inplace_marker) {
|
14356
14421
|
if (scrivito.editing_context.visible_workspace.is_editable() &&
|
14357
14422
|
scrivito.editing_context.is_editing_mode()) {
|
14358
14423
|
_.each(scrivito.child_list_element.all(), function(child_list_element) {
|
14359
|
-
|
14360
|
-
var description = child_list_element.obj().description_for_editor();
|
14361
|
-
menu.set_description(dom_element,
|
14362
|
-
scrivito.i18n.translate('child_list_menu.description', description));
|
14363
|
-
_.each([
|
14424
|
+
child_list_element.set_menu([
|
14364
14425
|
scrivito.add_subpage_command(child_list_element),
|
14365
14426
|
scrivito.copy_page_from_clipboard_command(child_list_element),
|
14366
14427
|
scrivito.move_page_from_clipboard_command(child_list_element),
|
14367
14428
|
scrivito.sort_items_command(child_list_element)
|
14368
|
-
]
|
14369
|
-
|
14370
|
-
|
14429
|
+
]);
|
14430
|
+
|
14431
|
+
var description = scrivito.i18n.translate('child_list_menu.description',
|
14432
|
+
child_list_element.obj().description_for_editor());
|
14433
|
+
inplace_marker.activate_for(child_list_element, {description: description});
|
14371
14434
|
});
|
14372
14435
|
}
|
14373
14436
|
});
|
@@ -14412,9 +14475,11 @@ $(window).on('load', function() {
|
|
14412
14475
|
$.extend(scrivito, {
|
14413
14476
|
image_upload: {
|
14414
14477
|
init: function() {
|
14415
|
-
scrivito.on('
|
14416
|
-
|
14417
|
-
|
14478
|
+
scrivito.on('load', function() {
|
14479
|
+
if (scrivito.in_editable_view()) {
|
14480
|
+
activate_for_field_type('linklist');
|
14481
|
+
activate_for_field_type('reference');
|
14482
|
+
}
|
14418
14483
|
});
|
14419
14484
|
|
14420
14485
|
// Disable DnD for all elements by default to prevent the user
|
@@ -14746,6 +14811,8 @@ $(window).on('load', function() {
|
|
14746
14811
|
|
14747
14812
|
|
14748
14813
|
|
14814
|
+
|
14815
|
+
|
14749
14816
|
|
14750
14817
|
|
14751
14818
|
|
data/lib/scrivito/basic_obj.rb
CHANGED
@@ -470,15 +470,12 @@ module Scrivito
|
|
470
470
|
end
|
471
471
|
|
472
472
|
# This should be a SET, because it's faster in this particular case.
|
473
|
-
|
473
|
+
INTERNAL_KEYS = Set.new(%w[
|
474
474
|
body
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
path
|
480
|
-
permalink
|
481
|
-
text_links
|
475
|
+
_id
|
476
|
+
_last_changed
|
477
|
+
_path
|
478
|
+
_permalink
|
482
479
|
title
|
483
480
|
])
|
484
481
|
|
@@ -487,11 +484,8 @@ module Scrivito
|
|
487
484
|
# @api public
|
488
485
|
def [](key)
|
489
486
|
key = key.to_s
|
490
|
-
if
|
491
|
-
|
492
|
-
elsif key.start_with?('_') && OLD_INTERNAL_KEYS.include?(internal_key = key[1..-1])
|
493
|
-
# For backwards compatibility reasons
|
494
|
-
send(internal_key)
|
487
|
+
if INTERNAL_KEYS.include?(key)
|
488
|
+
read_attribute(key)
|
495
489
|
else
|
496
490
|
super
|
497
491
|
end
|
@@ -528,6 +522,8 @@ module Scrivito
|
|
528
522
|
end
|
529
523
|
|
530
524
|
def new?(revision=Workspace.current.base_revision)
|
525
|
+
return false unless revision
|
526
|
+
|
531
527
|
if read_attribute('_modification') != 'deleted'
|
532
528
|
cms_data_for_revision(revision).nil?
|
533
529
|
else
|
@@ -536,12 +532,16 @@ module Scrivito
|
|
536
532
|
end
|
537
533
|
|
538
534
|
def deleted?(revision=Workspace.current.base_revision)
|
535
|
+
return false unless revision
|
536
|
+
|
539
537
|
if read_attribute('_modification') == 'deleted'
|
540
538
|
cms_data_for_revision(revision).present?
|
541
539
|
end
|
542
540
|
end
|
543
541
|
|
544
542
|
def modification(revision=Workspace.current.base_revision)
|
543
|
+
return Modification::UNMODIFIED unless revision
|
544
|
+
|
545
545
|
obj_data_from_revision = cms_data_for_revision(revision)
|
546
546
|
|
547
547
|
if deleted?(revision)
|
@@ -608,7 +608,7 @@ module Scrivito
|
|
608
608
|
if binary?
|
609
609
|
nil
|
610
610
|
else
|
611
|
-
|
611
|
+
read_attribute('body')
|
612
612
|
end
|
613
613
|
end
|
614
614
|
|
@@ -160,14 +160,18 @@ class BasicWidget
|
|
160
160
|
end
|
161
161
|
|
162
162
|
def new?(revision=Workspace.current.base_revision)
|
163
|
+
return false unless revision
|
163
164
|
obj.new?(revision) || cms_data_for_revision(revision).nil?
|
164
165
|
end
|
165
166
|
|
166
167
|
def deleted?(revision=Workspace.current.base_revision)
|
168
|
+
return false unless revision
|
167
169
|
obj.deleted?(revision)
|
168
170
|
end
|
169
171
|
|
170
172
|
def modification(revision=Workspace.current.base_revision)
|
173
|
+
return Modification::UNMODIFIED unless revision
|
174
|
+
|
171
175
|
if deleted?(revision)
|
172
176
|
Modification::DELETED
|
173
177
|
elsif new?(revision)
|
@@ -233,6 +237,13 @@ class BasicWidget
|
|
233
237
|
update_data(update_proc)
|
234
238
|
end
|
235
239
|
|
240
|
+
# This method determines the description that is shown in the widget tooltips.
|
241
|
+
# It can be overriden by a custom value.
|
242
|
+
# @api public
|
243
|
+
def description_for_editor
|
244
|
+
obj_class_name
|
245
|
+
end
|
246
|
+
|
236
247
|
private
|
237
248
|
|
238
249
|
def data_from_cms
|
@@ -6,9 +6,17 @@ class ClientConfig < Struct.new(:obj, :editing_context, :lookup_context)
|
|
6
6
|
config[:editing_context] = editing_context_config
|
7
7
|
config[:i18n] = i18n_config
|
8
8
|
config[:obj] = obj_config
|
9
|
+
config[:open_resource_dialog] = @resource_dialog_config
|
9
10
|
config.to_json
|
10
11
|
end
|
11
12
|
|
13
|
+
def open_resource_dialog(obj_id, redirect_to)
|
14
|
+
@resource_dialog_config = {
|
15
|
+
obj_id: obj_id,
|
16
|
+
redirect_to: redirect_to,
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
12
20
|
private
|
13
21
|
|
14
22
|
def editing_context_config
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrivito_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Infopark AG
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|