scrivito_sdk 0.50.1 → 0.60.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/scrivito/objs_controller.rb +25 -21
- data/app/controllers/scrivito/ui_controller.rb +1 -1
- data/app/controllers/scrivito/webservice_controller.rb +1 -1
- data/app/models/scrivito/content_widget.rb +1 -3
- data/app/views/cms/index.html.erb +3 -0
- data/app/views/scrivito/objs/destroy.json.jbuilder +1 -0
- data/app/views/scrivito/objs/show.json.jbuilder +2 -0
- data/app/views/scrivito/objs/update.json.jbuilder +1 -1
- data/app/views/scrivito/objs/{widget_modification.json.jbuilder → widget.json.jbuilder} +0 -0
- data/config/ca-bundle.crt +24 -219
- data/config/precedence_routes.rb +60 -0
- data/config/routes.rb +13 -46
- data/lib/assets/javascripts/scrivito_ui.js +360 -202
- data/lib/assets/stylesheets/scrivito_sdk.css +1 -1
- data/lib/assets/stylesheets/scrivito_ui.css +1 -1
- data/lib/generators/scrivito/install/templates/app/models/download.rb +1 -3
- data/lib/generators/scrivito/install/templates/app/models/headline_widget.rb +1 -5
- data/lib/generators/scrivito/install/templates/app/models/image.rb +1 -3
- data/lib/generators/scrivito/install/templates/app/models/image_widget.rb +1 -5
- data/lib/generators/scrivito/install/templates/app/models/page.rb +3 -6
- data/lib/generators/scrivito/install/templates/app/models/text_widget.rb +1 -5
- data/lib/generators/scrivito/install/templates/scrivito/migrate/install_scrivito_migration.rb +1 -25
- data/lib/generators/scrivito/migration/templates/migration.erb +2 -26
- data/lib/generators/scrivito/page/page_generator.rb +0 -11
- data/lib/generators/scrivito/page/templates/model.erb +3 -7
- data/lib/generators/scrivito/widget/widget_generator.rb +0 -11
- data/lib/scrivito/attribute.rb +10 -16
- data/lib/scrivito/attribute_collection.rb +4 -0
- data/lib/scrivito/attribute_content.rb +239 -161
- data/lib/scrivito/attribute_definition.rb +16 -10
- data/lib/scrivito/attribute_definition_collection.rb +7 -4
- data/lib/scrivito/attribute_definition_migrator.rb +1 -3
- data/lib/scrivito/attribute_deserializer.rb +111 -0
- data/lib/scrivito/attribute_serializer.rb +189 -0
- data/lib/scrivito/basic_obj.rb +113 -78
- data/lib/scrivito/basic_widget.rb +103 -37
- data/lib/scrivito/binary.rb +3 -3
- data/lib/scrivito/cache/chainable.rb +10 -4
- data/lib/scrivito/cache/file_store.rb +7 -4
- data/lib/scrivito/cache/ram_store.rb +1 -1
- data/lib/scrivito/class_collection.rb +2 -2
- data/lib/scrivito/client_config.rb +7 -6
- data/lib/scrivito/cms_backend.rb +2 -2
- data/lib/scrivito/cms_field_tag.rb +33 -25
- data/lib/scrivito/cms_rest_api/{attribute_serializer.rb → legacy_attribute_serializer.rb} +1 -1
- data/lib/scrivito/cms_routing.rb +20 -14
- data/lib/scrivito/configuration.rb +1 -1
- data/lib/scrivito/controller_actions.rb +12 -4
- data/lib/scrivito/date_attribute.rb +8 -0
- data/lib/scrivito/diff.rb +1 -1
- data/lib/scrivito/editing_context.rb +1 -1
- data/lib/scrivito/editing_context_middleware.rb +1 -1
- data/lib/scrivito/errors.rb +4 -0
- data/lib/scrivito/link_parser.rb +6 -1
- data/lib/scrivito/migrations/cms_backend.rb +17 -60
- data/lib/scrivito/migrations/migration_store.rb +0 -1
- data/lib/scrivito/model_library.rb +6 -6
- data/lib/scrivito/obj_class.rb +34 -48
- data/lib/scrivito/obj_class_collection.rb +21 -3
- data/lib/scrivito/obj_create_params_parser.rb +2 -1
- data/lib/scrivito/obj_data.rb +9 -103
- data/lib/scrivito/obj_data_from_hash.rb +19 -21
- data/lib/scrivito/obj_data_from_service.rb +28 -48
- data/lib/scrivito/obj_params_parser.rb +14 -14
- data/lib/scrivito/obj_search_enumerator.rb +1 -1
- data/lib/scrivito/obj_update_params_parser.rb +2 -2
- data/lib/scrivito/restriction_set.rb +1 -1
- data/lib/scrivito/sdk_engine.rb +2 -2
- data/lib/scrivito/test_request.rb +10 -0
- data/lib/scrivito/type_computer.rb +5 -1
- data/lib/scrivito/widget_collection.rb +15 -0
- data/lib/scrivito/widget_garbage_collection.rb +1 -1
- data/lib/scrivito/widget_tag.rb +2 -0
- data/lib/scrivito/workspace.rb +2 -1
- data/lib/scrivito/workspace_data_from_service.rb +1 -0
- data/lib/scrivito_sdk.rb +17 -1
- metadata +36 -34
- data/app/views/scrivito/objs/modification.json.jbuilder +0 -1
- data/config/cms_routes.rb +0 -22
- data/lib/generators/scrivito/page/templates/migration.erb +0 -9
- data/lib/generators/scrivito/widget/templates/migration.erb +0 -7
data/config/routes.rb
CHANGED
@@ -1,48 +1,15 @@
|
|
1
1
|
Rails.application.routes.draw do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
post :duplicate
|
16
|
-
|
17
|
-
put :revert
|
18
|
-
put :restore
|
19
|
-
put :mark_resolved
|
20
|
-
put :destroy_widget
|
21
|
-
put :revert_widget
|
22
|
-
put :restore_widget
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
resources :tasks, controller: 'scrivito/tasks', path: '__scrivito/tasks', only: [:show],
|
27
|
-
defaults: {format: :json}
|
28
|
-
|
29
|
-
get '__scrivito/blobs/upload_permission' => 'scrivito/blobs#upload_permission',
|
30
|
-
defaults: {format: :json}
|
31
|
-
|
32
|
-
resources :workspaces,
|
33
|
-
controller: 'scrivito/workspaces',
|
34
|
-
path: '__scrivito/workspaces',
|
35
|
-
only: [:index, :show, :create, :update, :destroy],
|
36
|
-
defaults: {format: :json} do
|
37
|
-
member do
|
38
|
-
put :rebase
|
39
|
-
put :publish
|
40
|
-
get :check
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
get '__scrivito/users/suggest' => 'scrivito/users#suggest', defaults: {format: :json}
|
45
|
-
|
46
|
-
get 'scrivito', to: 'scrivito/ui#index', as: 'scrivito_ui'
|
47
|
-
get 'scrivito/*application_path', to: 'scrivito/ui#index', format: false
|
2
|
+
get '/' => 'scrivito/cms_dispatch#index', as: :scrivito_root
|
3
|
+
|
4
|
+
match ':id(/*slug)',
|
5
|
+
to: 'scrivito/cms_dispatch#index',
|
6
|
+
constraints: { id: /\d+|[0-9a-f]{16}/ },
|
7
|
+
as: 'cms_id',
|
8
|
+
via: :all
|
9
|
+
|
10
|
+
match '/*permalink',
|
11
|
+
to: 'scrivito/cms_dispatch#index',
|
12
|
+
as: :scrivito_permalink,
|
13
|
+
format: false,
|
14
|
+
via: :all
|
48
15
|
end
|
@@ -23965,7 +23965,7 @@ helpers = helpers || Handlebars.helpers; data = data || {};
|
|
23965
23965
|
|
23966
23966
|
|
23967
23967
|
|
23968
|
-
return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_workspace_select\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_current_page_menu\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_current_page_restriction\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n";
|
23968
|
+
return "<div class=\"scrivito_topbar\">\n <div class=\"scrivito_first_level\">\n <div id=\"scrivito_menu_bar_toggle\" class=\"scrivito_viewmodes_wrapper\"></div>\n <div class=\"scrivito_button_bar scrivito_app scrivito_no_hover\"><span class=\"scrivito_logo\"></span></div>\n <div id=\"scrivito_workspace_select\" class=\"scrivito_button_bar\"></div>\n <div id=\"scrivito_current_page_menu\" class=\"scrivito_button_bar scrivito_right\"></div>\n <div id=\"scrivito_current_page_restriction\"></div>\n <div id=\"scrivito_menu_bar_warning\"></div>\n <div id=\"scrivito_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n";
|
23969
23969
|
});
|
23970
23970
|
return this.ScrivitoHandlebarsTemplates["menu_bar"];
|
23971
23971
|
}).call(this);
|
@@ -24002,6 +24002,22 @@ helpers = helpers || Handlebars.helpers; data = data || {};
|
|
24002
24002
|
});
|
24003
24003
|
return this.ScrivitoHandlebarsTemplates["menu_bar_toggle"];
|
24004
24004
|
}).call(this);
|
24005
|
+
(function() {
|
24006
|
+
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
24007
|
+
this.ScrivitoHandlebarsTemplates["menu_bar_warning"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
24008
|
+
this.compilerInfo = [3,'>= 1.0.0-rc.4'];
|
24009
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
24010
|
+
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
24011
|
+
|
24012
|
+
|
24013
|
+
buffer += "<span class=\"scrivito_menu_bar_warning scrivito_hidden\">\n <i class=\"scrivito_icon\"></i>\n <span class=\"scrivito_button_label\"><span>";
|
24014
|
+
options = {hash:{},data:data};
|
24015
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_warning.warning", options) : helperMissing.call(depth0, "translate", "menu_bar_warning.warning", options)))
|
24016
|
+
+ "</span></span>\n</div>\n";
|
24017
|
+
return buffer;
|
24018
|
+
});
|
24019
|
+
return this.ScrivitoHandlebarsTemplates["menu_bar_warning"];
|
24020
|
+
}).call(this);
|
24005
24021
|
(function() {
|
24006
24022
|
this.ScrivitoHandlebarsTemplates || (this.ScrivitoHandlebarsTemplates = {});
|
24007
24023
|
this.ScrivitoHandlebarsTemplates["menu_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
@@ -24584,7 +24600,7 @@ $.i18n().load({
|
|
24584
24600
|
'menu_item.spinner.loading': 'Laden...',
|
24585
24601
|
|
24586
24602
|
'choose_obj_class_dialog.add_child_page.title': 'Seitenvorlage auswählen',
|
24587
|
-
'choose_obj_class_dialog.
|
24603
|
+
'choose_obj_class_dialog.create_widget.title': 'Widget auswählen',
|
24588
24604
|
|
24589
24605
|
'editable_ws_dialog.title.select_or_create': 'Arbeitskopie wählen',
|
24590
24606
|
'editable_ws_dialog.title.select': 'Arbeitskopie auswählen',
|
@@ -24626,6 +24642,11 @@ $.i18n().load({
|
|
24626
24642
|
'saving_indicator_item.saving': 'Wird gespeichert...',
|
24627
24643
|
'saving_indicator_item.saved': 'Änderungen gespeichert',
|
24628
24644
|
|
24645
|
+
'menu_bar_warning.warning': 'JS-Konsole überprüfen',
|
24646
|
+
'menu_bar_warning.open_console': 'Es gibt Warnhinweise. Bitte öffnen Sie die JavaScript-Konsole, um Details zu erfahren.',
|
24647
|
+
|
24648
|
+
'inplace_marker.overlapping': 'Zwei oder mehrere Menü-Handles überschneiden sich. Bitte passen Sie Ihr CSS an. Die folgenden Menü-Handles überschneiden sich:',
|
24649
|
+
|
24629
24650
|
'widget_marker.widget_is_new': 'Widget ist neu',
|
24630
24651
|
'widget_marker.widget_is_edited': 'Widget wurde geändert',
|
24631
24652
|
'widget_marker.widget_is_edited_and_dragged_here': 'Widget wurde geändert und hierher gezogen',
|
@@ -24660,6 +24681,9 @@ $.i18n().load({
|
|
24660
24681
|
'commands.rebase_workspace.title': 'Aktualisieren',
|
24661
24682
|
'commands.rebase_workspace.tooltip': 'Arbeitskopie "$1" is veraltet. Bitte aktualisieren Sie sie.',
|
24662
24683
|
'commands.rebase_workspace.uptodate': 'Arbeitskopie "$1" muss nicht aktualisiert werden.',
|
24684
|
+
'commands.rebase_workspace.has_conflicts.title': 'Geänderte Inhalte wurden zwischenzeitlich veröffentlicht',
|
24685
|
+
'commands.rebase_workspace.has_conflicts.description': 'Ihre Arbeitskopie konnte nicht vollständig aktualisiert werden. Einige Inhalte wurden auch in einer anderen Arbeitskopie geändert, die inzwischen veröffentlicht wurde. Bitte entnehmen Sie die Details der Liste der Änderungen.',
|
24686
|
+
'commands.rebase_workspace.open_changes_dialog': 'Änderungen anzeigen',
|
24663
24687
|
|
24664
24688
|
'commands.delete_workspace.title': 'Löschen',
|
24665
24689
|
'commands.delete_workspace.dialog.title': 'Wirklich "$1" löschen?',
|
@@ -24732,7 +24756,9 @@ $.i18n().load({
|
|
24732
24756
|
'commands.sort_items.auto_sort': 'Diese Navigation wird automatisch sortiert.',
|
24733
24757
|
'commands.sort_items.too_less_children': 'Die Navigation kann nicht sortiert werden, weil sie weniger als zwei Elemente enthält.',
|
24734
24758
|
|
24735
|
-
'commands.
|
24759
|
+
'commands.choose_and_create_widget.title': 'Widget einfügen',
|
24760
|
+
'commands.choose_and_create_widget.disabled': 'Es ist nicht erlaubt in dieses Feld Widgets einzufügen',
|
24761
|
+
'commands.create_widget.title': '$1 einfügen',
|
24736
24762
|
|
24737
24763
|
'commands.add_content.title': 'Inhalt einfügen',
|
24738
24764
|
'commands.add_content.not_allowed': 'Es ist nicht erlaubt in dieses Feld beliebige Inhalte einzufügen',
|
@@ -24746,8 +24772,8 @@ $.i18n().load({
|
|
24746
24772
|
'commands.save_widget_to_clipboard.content_title': 'Inhalt zum Kopieren markieren',
|
24747
24773
|
'commands.save_widget_to_clipboard.widget_title': 'Widget zum Kopieren markieren',
|
24748
24774
|
|
24749
|
-
'commands.copy_widget_from_clipboard.content_title': 'Kopie des markierten Inhalts
|
24750
|
-
'commands.copy_widget_from_clipboard.widget_title': 'Kopie des markierten Widgets
|
24775
|
+
'commands.copy_widget_from_clipboard.content_title': 'Kopie des markierten Inhalts einfügen',
|
24776
|
+
'commands.copy_widget_from_clipboard.widget_title': 'Kopie des markierten Widgets einfügen',
|
24751
24777
|
'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',
|
24752
24778
|
|
24753
24779
|
'commands.delete_widget.content_title': 'Inhalt löschen',
|
@@ -24768,8 +24794,8 @@ $.i18n().load({
|
|
24768
24794
|
'commands.publish_workspace.dialog.confirm': 'Veröffentlichen',
|
24769
24795
|
'commands.publish_workspace.dialog.title': '"$1" veröffentlichen?',
|
24770
24796
|
'commands.publish_workspace.dialog.description': 'Eine Arbeitskopie zu veröffentlichen ist endgültig. Dieser Vorgang kann nicht rückgängig gemacht werden.',
|
24771
|
-
'commands.publish_workspace.error_dialog.title': '
|
24772
|
-
'commands.publish_workspace.error_dialog.description': '
|
24797
|
+
'commands.publish_workspace.error_dialog.title': 'Arbeitskopie konnte nicht veröffentlicht werden',
|
24798
|
+
'commands.publish_workspace.error_dialog.description': 'Bitte entnehmen Sie die Details der Liste der Änderungen.',
|
24773
24799
|
'commands.publish_workspace.error_dialog.confirm': 'Liste der Änderungen',
|
24774
24800
|
'commands.publish_workspace.alert.invalid_certificates': 'Die Arbeitskopie konnte nicht veröffentlicht werden, weil mindestens ein Benutzer gerade Inhalte darin ändert.',
|
24775
24801
|
|
@@ -24812,7 +24838,7 @@ $.i18n().load({
|
|
24812
24838
|
'menu_item.spinner.loading': 'Loading...',
|
24813
24839
|
|
24814
24840
|
'choose_obj_class_dialog.add_child_page.title': 'Select Page Type',
|
24815
|
-
'choose_obj_class_dialog.
|
24841
|
+
'choose_obj_class_dialog.create_widget.title': 'Select Widget',
|
24816
24842
|
|
24817
24843
|
'editable_ws_dialog.title.select_or_create': 'Choose a working copy',
|
24818
24844
|
'editable_ws_dialog.title.select': 'Select a working copy',
|
@@ -24854,6 +24880,11 @@ $.i18n().load({
|
|
24854
24880
|
'saving_indicator_item.saving': 'Saving...',
|
24855
24881
|
'saving_indicator_item.saved': 'Changes saved',
|
24856
24882
|
|
24883
|
+
'menu_bar_warning.warning': 'Check JS console',
|
24884
|
+
'menu_bar_warning.open_console': 'There are warnings. Please open the JavaScript console for details.',
|
24885
|
+
|
24886
|
+
'inplace_marker.overlapping': 'Two or more menu handles are overlapping. Please adjust your CSS. The following menu handles are overlapping:',
|
24887
|
+
|
24857
24888
|
'widget_marker.widget_is_new': 'Widget is new',
|
24858
24889
|
'widget_marker.widget_is_edited': 'Widget has been modified',
|
24859
24890
|
'widget_marker.widget_is_edited_and_dragged_here': 'Widget has been modified and dragged here',
|
@@ -24888,6 +24919,9 @@ $.i18n().load({
|
|
24888
24919
|
'commands.rebase_workspace.title': 'Update',
|
24889
24920
|
'commands.rebase_workspace.tooltip': 'Working copy "$1" is outdated. Please update it.',
|
24890
24921
|
'commands.rebase_workspace.uptodate': 'Working copy "$1" is up to date.',
|
24922
|
+
'commands.rebase_workspace.has_conflicts.title': 'Changed content has been published intermediately',
|
24923
|
+
'commands.rebase_workspace.has_conflicts.description': 'Your working copy could not be fully updated. Some of its content has also been altered in a different working copy that has been published in the meantime. Please refer to the changes list for details.',
|
24924
|
+
'commands.rebase_workspace.open_changes_dialog': 'Show changes',
|
24891
24925
|
|
24892
24926
|
'commands.delete_workspace.title': 'Delete',
|
24893
24927
|
'commands.delete_workspace.dialog.title': 'Really delete "$1"?',
|
@@ -24962,7 +24996,9 @@ $.i18n().load({
|
|
24962
24996
|
|
24963
24997
|
'obj_sorting_dialog.title': 'Sort items',
|
24964
24998
|
|
24965
|
-
'commands.
|
24999
|
+
'commands.choose_and_create_widget.title': 'Insert widget',
|
25000
|
+
'commands.choose_and_create_widget.disabled': 'It is not allowed to insert widgets in this field',
|
25001
|
+
'commands.create_widget.title': 'Insert $1',
|
24966
25002
|
|
24967
25003
|
'commands.add_content.title': 'Insert content',
|
24968
25004
|
'commands.add_content.not_allowed': 'It is not allowed to insert random content into this field.',
|
@@ -24974,8 +25010,8 @@ $.i18n().load({
|
|
24974
25010
|
'commands.save_widget_to_clipboard.content_title': 'Mark content for copying',
|
24975
25011
|
'commands.save_widget_to_clipboard.widget_title': 'Mark widget for copying',
|
24976
25012
|
|
24977
|
-
'commands.copy_widget_from_clipboard.content_title': '
|
24978
|
-
'commands.copy_widget_from_clipboard.widget_title': '
|
25013
|
+
'commands.copy_widget_from_clipboard.content_title': 'Insert copy of marked content',
|
25014
|
+
'commands.copy_widget_from_clipboard.widget_title': 'Insert copy of marked widget',
|
24979
25015
|
'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',
|
24980
25016
|
|
24981
25017
|
'commands.delete_widget.content_title': 'Delete content',
|
@@ -24996,9 +25032,9 @@ $.i18n().load({
|
|
24996
25032
|
'commands.publish_workspace.dialog.confirm': 'Publish',
|
24997
25033
|
'commands.publish_workspace.dialog.title': 'Publish "$1"?',
|
24998
25034
|
'commands.publish_workspace.dialog.description': 'Publishing a working copy is final. This action cannot be undone.',
|
24999
|
-
'commands.publish_workspace.error_dialog.title': '
|
25000
|
-
'commands.publish_workspace.error_dialog.description': '
|
25001
|
-
'commands.publish_workspace.error_dialog.confirm': 'Open
|
25035
|
+
'commands.publish_workspace.error_dialog.title': 'Working copy could not be published',
|
25036
|
+
'commands.publish_workspace.error_dialog.description': 'Please check the changes list for details.',
|
25037
|
+
'commands.publish_workspace.error_dialog.confirm': 'Open changes list',
|
25002
25038
|
'commands.publish_workspace.alert.invalid_certificates': 'The working copy could not be published because at least one user is currently modifying content in it.',
|
25003
25039
|
|
25004
25040
|
'ajax.error': 'Communication with the CMS failed with error: $1',
|
@@ -25046,6 +25082,15 @@ var scrivito = {};
|
|
25046
25082
|
}
|
25047
25083
|
},
|
25048
25084
|
|
25085
|
+
warn: function() {
|
25086
|
+
if (scrivito.is_development_mode) {
|
25087
|
+
scrivito.menu_bar_warning.show();
|
25088
|
+
}
|
25089
|
+
if (window.console) {
|
25090
|
+
window.console.warn.apply(window.console, arguments);
|
25091
|
+
}
|
25092
|
+
},
|
25093
|
+
|
25049
25094
|
log_error: function(message, exception) {
|
25050
25095
|
if (window.console) {
|
25051
25096
|
window.console.error(message, exception);
|
@@ -25157,9 +25202,7 @@ var scrivito = {};
|
|
25157
25202
|
message += ' Please use "' + alternative + '" instead.';
|
25158
25203
|
}
|
25159
25204
|
|
25160
|
-
|
25161
|
-
window.console.warn(message);
|
25162
|
-
}
|
25205
|
+
scrivito.warn(message);
|
25163
25206
|
},
|
25164
25207
|
|
25165
25208
|
// @api public
|
@@ -25337,6 +25380,8 @@ var scrivito = {};
|
|
25337
25380
|
// FIXME content-widget
|
25338
25381
|
enable_content_upload: false,
|
25339
25382
|
|
25383
|
+
is_development_mode: false,
|
25384
|
+
|
25340
25385
|
init: function(config) {
|
25341
25386
|
scrivito.config = config;
|
25342
25387
|
|
@@ -25346,8 +25391,11 @@ var scrivito = {};
|
|
25346
25391
|
scrivito.user.init(config.user);
|
25347
25392
|
scrivito.user_permissions.init(config.user_permissions);
|
25348
25393
|
|
25394
|
+
scrivito.is_development_mode = config.is_development_mode;
|
25395
|
+
|
25349
25396
|
scrivito.inplace_marker.init();
|
25350
25397
|
scrivito.menu_bar_saving_indicator.init();
|
25398
|
+
scrivito.menu_bar_warning.init();
|
25351
25399
|
scrivito.menu_bar_toggle.init();
|
25352
25400
|
scrivito.current_page_menu.init();
|
25353
25401
|
scrivito.current_page_restriction.init();
|
@@ -25356,10 +25404,10 @@ var scrivito = {};
|
|
25356
25404
|
|
25357
25405
|
scrivito.child_list_commands.init();
|
25358
25406
|
scrivito.widget_commands.init();
|
25359
|
-
scrivito.
|
25407
|
+
scrivito.widgetlist_field_commands.init();
|
25360
25408
|
|
25361
25409
|
scrivito.child_list_marker.init();
|
25362
|
-
scrivito.
|
25410
|
+
scrivito.widgetlist_field_marker.init();
|
25363
25411
|
scrivito.widget_marker.init();
|
25364
25412
|
|
25365
25413
|
scrivito.menus.init();
|
@@ -25458,7 +25506,7 @@ var scrivito = {};
|
|
25458
25506
|
} else {
|
25459
25507
|
var cms_element = build_cms_element(dom_element);
|
25460
25508
|
cms_element.set_original_content(content);
|
25461
|
-
return cms_element.save(content).
|
25509
|
+
return cms_element.save(content).then(function() { return; }, function(error) {
|
25462
25510
|
return {message: error.message};
|
25463
25511
|
});
|
25464
25512
|
}
|
@@ -26177,6 +26225,34 @@ var scrivito = {};
|
|
26177
26225
|
}
|
26178
26226
|
});
|
26179
26227
|
}());
|
26228
|
+
(function() {
|
26229
|
+
$.extend(scrivito, {
|
26230
|
+
menu_bar_warning: {
|
26231
|
+
init: function() {
|
26232
|
+
scrivito.menu_bar.register_item_renderer(function(parent_view) {
|
26233
|
+
scrivito.menu_bar_warning.create(
|
26234
|
+
parent_view.find('#scrivito_menu_bar_warning'));
|
26235
|
+
});
|
26236
|
+
},
|
26237
|
+
|
26238
|
+
create: function(parent_view) {
|
26239
|
+
parent_view.append(scrivito.template.render('menu_bar_warning'));
|
26240
|
+
$(parent_view).on('click', function() {
|
26241
|
+
scrivito.alert_dialog(scrivito.t('menu_bar_warning.open_console'));
|
26242
|
+
scrivito.menu_bar_warning.hide();
|
26243
|
+
});
|
26244
|
+
},
|
26245
|
+
|
26246
|
+
show: function() {
|
26247
|
+
$('.scrivito_menu_bar_warning').show();
|
26248
|
+
},
|
26249
|
+
|
26250
|
+
hide: function() {
|
26251
|
+
$('.scrivito_menu_bar_warning').hide();
|
26252
|
+
}
|
26253
|
+
}
|
26254
|
+
});
|
26255
|
+
}());
|
26180
26256
|
(function() {
|
26181
26257
|
$.extend(scrivito, {
|
26182
26258
|
menu_bar_toggle: {
|
@@ -26693,6 +26769,7 @@ var scrivito = {};
|
|
26693
26769
|
form_data.append('file', file); // File must be appended last, otherwise S3 will complain.
|
26694
26770
|
|
26695
26771
|
permission.blob.filename = file.name.replace(/[^\w\-_\.$]/g, '-');
|
26772
|
+
permission.blob.content_type = file.type;
|
26696
26773
|
|
26697
26774
|
return $.ajax({type: 'POST', url: permission.url, data: form_data,
|
26698
26775
|
// These are needed in order for jQuery to work properly with a FormData.
|
@@ -27048,7 +27125,9 @@ var scrivito = {};
|
|
27048
27125
|
|
27049
27126
|
return request_promise.then(function(model_data) {
|
27050
27127
|
var field_data = model_data[that.field_name()];
|
27051
|
-
|
27128
|
+
if (field_data) {
|
27129
|
+
return field_data[0];
|
27130
|
+
}
|
27052
27131
|
});
|
27053
27132
|
},
|
27054
27133
|
|
@@ -27457,7 +27536,9 @@ var scrivito = {};
|
|
27457
27536
|
},
|
27458
27537
|
|
27459
27538
|
destroy: function() {
|
27460
|
-
return scrivito.ajax('DELETE', 'objs/' + that.id())
|
27539
|
+
return scrivito.ajax('DELETE', 'objs/' + that.id()).then(function(result) {
|
27540
|
+
return result.redirect_to;
|
27541
|
+
});
|
27461
27542
|
},
|
27462
27543
|
|
27463
27544
|
destroy_widget: function(widget_id) {
|
@@ -27473,10 +27554,6 @@ var scrivito = {};
|
|
27473
27554
|
return scrivito.ajax('PUT', 'objs/'+that.id()+'/revert_widget?widget_id='+widget_id);
|
27474
27555
|
},
|
27475
27556
|
|
27476
|
-
update_widget_modification: function(widget_id) {
|
27477
|
-
return scrivito.ajax('GET', 'objs/' + that.id() + '/widget_modification?widget_id=' + widget_id);
|
27478
|
-
},
|
27479
|
-
|
27480
27557
|
restore: function() {
|
27481
27558
|
return scrivito.ajax('PUT', 'objs/' + that.id() + '/restore');
|
27482
27559
|
},
|
@@ -27507,10 +27584,15 @@ var scrivito = {};
|
|
27507
27584
|
});
|
27508
27585
|
},
|
27509
27586
|
|
27510
|
-
|
27511
|
-
return scrivito.ajax('GET', 'objs/'
|
27587
|
+
reload: function() {
|
27588
|
+
return scrivito.ajax('GET', 'objs/'+that.id()).then(function(data) {
|
27589
|
+
params.has_conflict = data.has_conflict;
|
27512
27590
|
params.modification = data.modification;
|
27513
27591
|
});
|
27592
|
+
},
|
27593
|
+
|
27594
|
+
reload_widget: function(widget_id) {
|
27595
|
+
return scrivito.ajax('GET', 'objs/'+that.id()+'/widget?widget_id='+widget_id);
|
27514
27596
|
}
|
27515
27597
|
};
|
27516
27598
|
|
@@ -27855,7 +27937,7 @@ var scrivito = {};
|
|
27855
27937
|
save: function(widget_attributes) {
|
27856
27938
|
var obj_attributes = build_obj_attributes(widget_attributes);
|
27857
27939
|
return that.obj().save(obj_attributes).then(function(obj_data) {
|
27858
|
-
return obj_data._widget_pool[that.id()];
|
27940
|
+
return obj_data._widget_pool[0][that.id()];
|
27859
27941
|
});
|
27860
27942
|
},
|
27861
27943
|
|
@@ -27894,8 +27976,8 @@ var scrivito = {};
|
|
27894
27976
|
return scrivito.ajax('GET', that.markup_url(action_name), {dataType: 'html'});
|
27895
27977
|
},
|
27896
27978
|
|
27897
|
-
|
27898
|
-
return that.obj().
|
27979
|
+
reload: function() {
|
27980
|
+
return that.obj().reload_widget(that.id()).then(function(data) {
|
27899
27981
|
options.modification = data.modification;
|
27900
27982
|
});
|
27901
27983
|
}
|
@@ -27970,9 +28052,9 @@ var scrivito = {};
|
|
27970
28052
|
}());
|
27971
28053
|
(function() {
|
27972
28054
|
$.extend(scrivito, {
|
27973
|
-
|
28055
|
+
widgetlist_field_element: {
|
27974
28056
|
create_instance: function(cms_element) {
|
27975
|
-
if (cms_element.dom_element().attr('data-scrivito-field-type') === '
|
28057
|
+
if (cms_element.dom_element().attr('data-scrivito-field-type') === 'widgetlist') {
|
27976
28058
|
var that = scrivito.cms_field_element.create_instance(cms_element);
|
27977
28059
|
|
27978
28060
|
$.extend(that, {
|
@@ -28002,17 +28084,28 @@ var scrivito = {};
|
|
28002
28084
|
}
|
28003
28085
|
},
|
28004
28086
|
|
28005
|
-
|
28006
|
-
|
28007
|
-
|
28087
|
+
add_widget: function(widget_spec, widget_element) {
|
28088
|
+
var position;
|
28089
|
+
if (widget_element) {
|
28090
|
+
position = widget_element.dom_element()
|
28091
|
+
.prevAll('[data-scrivito-private-widget-id]').length;
|
28092
|
+
} else {
|
28093
|
+
position = that.widget_elements().length;
|
28094
|
+
}
|
28008
28095
|
|
28009
|
-
|
28010
|
-
|
28011
|
-
},
|
28096
|
+
var content = that.content();
|
28097
|
+
content.splice(position, 0, widget_spec);
|
28012
28098
|
|
28013
|
-
|
28014
|
-
|
28015
|
-
|
28099
|
+
return that.save(content).then(function(field_data) {
|
28100
|
+
var new_widget_id;
|
28101
|
+
if (field_data.list) {
|
28102
|
+
new_widget_id = field_data.list[position].widget;
|
28103
|
+
} else {
|
28104
|
+
new_widget_id = field_data[position];
|
28105
|
+
}
|
28106
|
+
var widget = scrivito.widget.create_instance(that.obj(), new_widget_id);
|
28107
|
+
return prepend_widget(widget, widget_element);
|
28108
|
+
});
|
28016
28109
|
},
|
28017
28110
|
|
28018
28111
|
fetch_widget_class_selection: function() {
|
@@ -28026,12 +28119,28 @@ var scrivito = {};
|
|
28026
28119
|
},
|
28027
28120
|
|
28028
28121
|
allowed_classes: function() {
|
28029
|
-
|
28122
|
+
return _.map(allowed_classes_json(), function(obj_class) {
|
28123
|
+
return obj_class.name;
|
28124
|
+
});
|
28125
|
+
},
|
28030
28126
|
|
28031
|
-
|
28032
|
-
|
28033
|
-
|
28034
|
-
|
28127
|
+
allowed_classes_for_create: function() {
|
28128
|
+
return _.without(that.allowed_classes(), 'Scrivito::ContentWidget');
|
28129
|
+
},
|
28130
|
+
|
28131
|
+
can_create_widget: function() {
|
28132
|
+
return that.allowed_classes_for_create().length !== 0;
|
28133
|
+
},
|
28134
|
+
|
28135
|
+
can_choose_widget_class: function() {
|
28136
|
+
return that.allowed_classes_for_create().length > 1;
|
28137
|
+
},
|
28138
|
+
|
28139
|
+
description_for_allowed_class: function(class_name) {
|
28140
|
+
var allowed_class = _.findWhere(allowed_classes_json(), {name: class_name});
|
28141
|
+
|
28142
|
+
if (allowed_class) {
|
28143
|
+
return allowed_class.description;
|
28035
28144
|
}
|
28036
28145
|
},
|
28037
28146
|
|
@@ -28047,9 +28156,17 @@ var scrivito = {};
|
|
28047
28156
|
|
28048
28157
|
is_content_widget_allowed: function() {
|
28049
28158
|
return that.is_valid_child_class('Scrivito::ContentWidget');
|
28050
|
-
}
|
28159
|
+
}
|
28160
|
+
});
|
28161
|
+
|
28162
|
+
var allowed_classes_json = function() {
|
28163
|
+
var allowed_classes = that.dom_element().attr('data-scrivito-private-field-widget-allowed-classes');
|
28164
|
+
|
28165
|
+
return JSON.parse(allowed_classes);
|
28166
|
+
};
|
28051
28167
|
|
28052
|
-
|
28168
|
+
var prepend_widget = function(widget, widget_element) {
|
28169
|
+
return widget.fetch_show_markup().then(function(widget_markup) {
|
28053
28170
|
var dom_element = $($.trim(widget_markup));
|
28054
28171
|
if (widget_element) {
|
28055
28172
|
widget_element.dom_element().before(dom_element);
|
@@ -28057,36 +28174,11 @@ var scrivito = {};
|
|
28057
28174
|
that.dom_element().prepend(dom_element);
|
28058
28175
|
}
|
28059
28176
|
scrivito.gui.new_content(dom_element.get(0));
|
28060
|
-
return dom_element;
|
28061
|
-
},
|
28062
|
-
|
28063
|
-
append_widget_markup: function(widget_markup, widget_element) {
|
28064
|
-
var dom_element = $($.trim(widget_markup));
|
28065
|
-
if (widget_element) {
|
28066
|
-
widget_element.dom_element().after(dom_element);
|
28067
|
-
} else {
|
28068
|
-
that.dom_element().append(dom_element);
|
28069
|
-
}
|
28070
|
-
scrivito.gui.new_content(dom_element.get(0));
|
28071
|
-
return dom_element;
|
28072
|
-
}
|
28073
|
-
});
|
28074
28177
|
|
28075
|
-
|
28076
|
-
|
28077
|
-
if (widget_element) {
|
28078
|
-
position = widget_element.dom_element()
|
28079
|
-
.prevAll('[data-scrivito-private-widget-id]').length + 1;
|
28080
|
-
} else {
|
28081
|
-
position = that.widget_elements().length;
|
28082
|
-
}
|
28083
|
-
|
28084
|
-
var content = that.content();
|
28085
|
-
content.splice(position, 0, widget_spec);
|
28178
|
+
scrivito.ensure_fully_visible_within_application_window(dom_element);
|
28179
|
+
scrivito.widget_sorting.update_placeholder(that);
|
28086
28180
|
|
28087
|
-
|
28088
|
-
var new_widget_id = field_data.list[position].widget;
|
28089
|
-
return scrivito.widget.create_instance(that.obj(), new_widget_id);
|
28181
|
+
return widget;
|
28090
28182
|
});
|
28091
28183
|
};
|
28092
28184
|
|
@@ -28095,12 +28187,12 @@ var scrivito = {};
|
|
28095
28187
|
},
|
28096
28188
|
|
28097
28189
|
all: function(root_element) {
|
28098
|
-
return scrivito.cms_element.all('[data-scrivito-field-type="
|
28190
|
+
return scrivito.cms_element.all('[data-scrivito-field-type="widgetlist"]', root_element);
|
28099
28191
|
}
|
28100
28192
|
}
|
28101
28193
|
});
|
28102
28194
|
|
28103
|
-
scrivito.cms_element.definitions.push(scrivito.
|
28195
|
+
scrivito.cms_element.definitions.push(scrivito.widgetlist_field_element);
|
28104
28196
|
}());
|
28105
28197
|
(function() {
|
28106
28198
|
$.extend(scrivito, {
|
@@ -28180,6 +28272,13 @@ var scrivito = {};
|
|
28180
28272
|
return scrivito.ajax('GET', 'workspaces/' + that.id()).then(function(details) {
|
28181
28273
|
return details.memberships;
|
28182
28274
|
});
|
28275
|
+
},
|
28276
|
+
|
28277
|
+
has_conflicts: function() {
|
28278
|
+
return scrivito.obj_where('_conflicts', 'equals', true).size().then(function(size) {
|
28279
|
+
var promise = $.Deferred();
|
28280
|
+
return size === 0 ? promise.reject() : promise.resolve();
|
28281
|
+
});
|
28183
28282
|
}
|
28184
28283
|
};
|
28185
28284
|
|
@@ -29089,8 +29188,7 @@ var scrivito = {};
|
|
29089
29188
|
|
29090
29189
|
refresh: function() {
|
29091
29190
|
if (!scrivito.editing_context.is_view_mode()) {
|
29092
|
-
|
29093
|
-
.find('.scrivito_editing_marker').remove();
|
29191
|
+
all_markers().remove();
|
29094
29192
|
|
29095
29193
|
_.each(callbacks, function(callback) {
|
29096
29194
|
callback(builder);
|
@@ -29100,6 +29198,15 @@ var scrivito = {};
|
|
29100
29198
|
}
|
29101
29199
|
},
|
29102
29200
|
|
29201
|
+
are_overlapping: function(dom_element1, dom_element2) {
|
29202
|
+
var a = dom_element1.getBoundingClientRect();
|
29203
|
+
var b = dom_element2.getBoundingClientRect();
|
29204
|
+
return a.left <= b.right &&
|
29205
|
+
b.left <= a.right &&
|
29206
|
+
a.top <= b.bottom &&
|
29207
|
+
b.top <= a.bottom;
|
29208
|
+
},
|
29209
|
+
|
29103
29210
|
// For test purpose only.
|
29104
29211
|
reset_callbacks: function() {
|
29105
29212
|
callbacks = [];
|
@@ -29107,12 +29214,29 @@ var scrivito = {};
|
|
29107
29214
|
}
|
29108
29215
|
});
|
29109
29216
|
|
29217
|
+
var all_markers = function() {
|
29218
|
+
return scrivito.application_window.document().dom_element().find('.scrivito_editing_marker');
|
29219
|
+
};
|
29220
|
+
|
29221
|
+
var warn_on_overlap = function(marker_dom) {
|
29222
|
+
var overlapping = _.filter(all_markers().not(marker_dom), function(other_marker_dom) {
|
29223
|
+
return scrivito.inplace_marker.are_overlapping(marker_dom, other_marker_dom);
|
29224
|
+
});
|
29225
|
+
if (overlapping.length > 0) {
|
29226
|
+
scrivito.warn.apply(null,
|
29227
|
+
_.flatten([scrivito.t('inplace_marker.overlapping'), marker_dom, overlapping]));
|
29228
|
+
}
|
29229
|
+
};
|
29230
|
+
|
29110
29231
|
var builder = {
|
29111
29232
|
activate_for: function(cms_element, options) {
|
29112
29233
|
var marker = $(scrivito.template.render('inplace_marker',
|
29113
29234
|
$.extend({icon: '\uf000'}, options || {})));
|
29114
29235
|
|
29115
29236
|
marker.on('click', function() {
|
29237
|
+
if (scrivito.is_development_mode) {
|
29238
|
+
warn_on_overlap(marker[0]);
|
29239
|
+
}
|
29116
29240
|
scrivito.menus.toggle(marker, cms_element.menu());
|
29117
29241
|
return false;
|
29118
29242
|
});
|
@@ -29221,11 +29345,11 @@ var scrivito = {};
|
|
29221
29345
|
(function() {
|
29222
29346
|
$.extend(scrivito, {
|
29223
29347
|
add_content_command: function(cms_element) {
|
29224
|
-
var
|
29348
|
+
var widgetlist_field_element, widget_element;
|
29225
29349
|
if (cms_element.widget_field) {
|
29226
29350
|
widget_element = cms_element;
|
29227
29351
|
} else {
|
29228
|
-
|
29352
|
+
widgetlist_field_element = cms_element;
|
29229
29353
|
}
|
29230
29354
|
|
29231
29355
|
return scrivito.command.create_instance({
|
@@ -29235,32 +29359,34 @@ var scrivito = {};
|
|
29235
29359
|
|
29236
29360
|
present: function() {
|
29237
29361
|
return scrivito.select_content && scrivito.editing_context.is_editing_mode() &&
|
29238
|
-
(widget_element ||
|
29362
|
+
(widget_element || widgetlist_field_element.is_empty());
|
29239
29363
|
},
|
29240
29364
|
|
29241
29365
|
disabled: function() {
|
29242
|
-
if (!(
|
29366
|
+
if (!(widgetlist_field_element || widget_element.widget_field())
|
29243
29367
|
.is_content_widget_allowed()) {
|
29244
29368
|
return scrivito.t('commands.add_content.not_allowed');
|
29245
29369
|
}
|
29246
29370
|
},
|
29247
29371
|
|
29248
29372
|
execute: function() {
|
29249
|
-
if (!
|
29250
|
-
|
29373
|
+
if (!widgetlist_field_element) {
|
29374
|
+
widgetlist_field_element = widget_element.widget_field();
|
29251
29375
|
}
|
29252
29376
|
|
29253
29377
|
scrivito.select_content().then(function(contents) {
|
29254
29378
|
var content = contents[0];
|
29255
29379
|
if (content) {
|
29256
|
-
var
|
29257
|
-
|
29258
|
-
|
29259
|
-
|
29260
|
-
|
29261
|
-
|
29262
|
-
|
29263
|
-
|
29380
|
+
var widget_params = {
|
29381
|
+
create: {
|
29382
|
+
_obj_class: 'Scrivito::ContentWidget',
|
29383
|
+
content: content
|
29384
|
+
}
|
29385
|
+
};
|
29386
|
+
|
29387
|
+
scrivito.with_saving_overlay(
|
29388
|
+
widgetlist_field_element.add_widget(widget_params, widget_element)
|
29389
|
+
);
|
29264
29390
|
}
|
29265
29391
|
});
|
29266
29392
|
}
|
@@ -29294,41 +29420,39 @@ var scrivito = {};
|
|
29294
29420
|
}());
|
29295
29421
|
(function() {
|
29296
29422
|
$.extend(scrivito, {
|
29297
|
-
|
29298
|
-
var
|
29423
|
+
choose_and_create_widget_command: function(cms_element) {
|
29424
|
+
var widgetlist_field_element, widget_element;
|
29299
29425
|
if (cms_element.widget_field) {
|
29300
29426
|
widget_element = cms_element;
|
29427
|
+
widgetlist_field_element = widget_element.widget_field();
|
29301
29428
|
} else {
|
29302
|
-
|
29429
|
+
widgetlist_field_element = cms_element;
|
29303
29430
|
}
|
29304
29431
|
|
29305
29432
|
return scrivito.command.create_instance({
|
29306
|
-
id: 'scrivito.sdk.
|
29307
|
-
title: scrivito.t('commands.
|
29433
|
+
id: 'scrivito.sdk.choose_and_create_widget',
|
29434
|
+
title: scrivito.t('commands.choose_and_create_widget.title'),
|
29308
29435
|
icon: '',
|
29309
29436
|
|
29310
29437
|
present: function() {
|
29311
29438
|
return scrivito.editing_context.is_editing_mode() &&
|
29312
|
-
(widget_element ||
|
29439
|
+
(widget_element || widgetlist_field_element.is_empty()) &&
|
29440
|
+
(widgetlist_field_element.can_choose_widget_class() ||
|
29441
|
+
!widgetlist_field_element.can_create_widget());
|
29313
29442
|
},
|
29314
29443
|
|
29315
|
-
|
29316
|
-
if (!
|
29317
|
-
|
29444
|
+
disabled: function() {
|
29445
|
+
if (!widgetlist_field_element.can_create_widget()) {
|
29446
|
+
return scrivito.t('commands.choose_and_create_widget.disabled');
|
29318
29447
|
}
|
29448
|
+
},
|
29319
29449
|
|
29320
|
-
|
29321
|
-
var
|
29322
|
-
|
29450
|
+
execute: function() {
|
29451
|
+
var choose_obj_class = scrivito.choose_obj_class_dialog(
|
29452
|
+
widgetlist_field_element.fetch_widget_class_selection(), 'create_widget');
|
29453
|
+
return choose_obj_class.then(function(obj_class) {
|
29323
29454
|
return scrivito.with_saving_overlay(
|
29324
|
-
|
29325
|
-
return widget.fetch_show_markup().then(function(widget_markup) {
|
29326
|
-
var dom_element = widget_field_element
|
29327
|
-
.append_widget_markup(widget_markup, widget_element);
|
29328
|
-
scrivito.ensure_fully_visible_within_application_window(dom_element);
|
29329
|
-
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
29330
|
-
});
|
29331
|
-
})
|
29455
|
+
widgetlist_field_element.add_widget({create: {_obj_class: obj_class}}, widget_element)
|
29332
29456
|
);
|
29333
29457
|
});
|
29334
29458
|
}
|
@@ -29369,11 +29493,11 @@ var scrivito = {};
|
|
29369
29493
|
(function() {
|
29370
29494
|
$.extend(scrivito, {
|
29371
29495
|
copy_widget_from_clipboard_command: function(cms_element) {
|
29372
|
-
var
|
29496
|
+
var widgetlist_field_element, widget_element;
|
29373
29497
|
if (cms_element.widget_field) {
|
29374
29498
|
widget_element = cms_element;
|
29375
29499
|
} else {
|
29376
|
-
|
29500
|
+
widgetlist_field_element = cms_element;
|
29377
29501
|
}
|
29378
29502
|
|
29379
29503
|
return scrivito.command.create_instance({
|
@@ -29388,40 +29512,72 @@ var scrivito = {};
|
|
29388
29512
|
present: function() {
|
29389
29513
|
return scrivito.editing_context.is_editing_mode() &&
|
29390
29514
|
scrivito.widget_clipboard.is_present() &&
|
29391
|
-
(widget_element ||
|
29515
|
+
(widget_element || widgetlist_field_element.is_empty());
|
29392
29516
|
},
|
29393
29517
|
|
29394
29518
|
disabled: function() {
|
29395
|
-
if (!
|
29396
|
-
|
29519
|
+
if (!widgetlist_field_element) {
|
29520
|
+
widgetlist_field_element = widget_element.widget_field();
|
29397
29521
|
}
|
29398
29522
|
var widget_class_name = scrivito.widget_clipboard.widget().widget_class_name();
|
29399
|
-
if (!
|
29523
|
+
if (!widgetlist_field_element.is_valid_child_class(widget_class_name)) {
|
29400
29524
|
return scrivito.t('commands.copy_widget_from_clipboard.paste_forbidden',
|
29401
|
-
|
29525
|
+
widgetlist_field_element.allowed_classes().join(', '));
|
29402
29526
|
}
|
29403
29527
|
},
|
29404
29528
|
|
29405
29529
|
execute: function() {
|
29406
|
-
if (!
|
29407
|
-
|
29530
|
+
if (!widgetlist_field_element) {
|
29531
|
+
widgetlist_field_element = widget_element.widget_field();
|
29408
29532
|
}
|
29409
29533
|
var widget = scrivito.widget_clipboard.widget();
|
29410
29534
|
var workspace_id = scrivito.widget_clipboard.workspace_id();
|
29411
|
-
var
|
29412
|
-
|
29413
|
-
|
29414
|
-
|
29415
|
-
|
29416
|
-
|
29417
|
-
|
29418
|
-
|
29419
|
-
|
29420
|
-
|
29421
|
-
|
29422
|
-
|
29423
|
-
|
29424
|
-
|
29535
|
+
var copy_params = {
|
29536
|
+
copy: {
|
29537
|
+
workspace_id: workspace_id,
|
29538
|
+
obj_id: widget.obj().id(),
|
29539
|
+
widget_id: widget.id()
|
29540
|
+
}
|
29541
|
+
};
|
29542
|
+
return scrivito.with_saving_overlay(
|
29543
|
+
widgetlist_field_element.add_widget(copy_params, widget_element)
|
29544
|
+
);
|
29545
|
+
}
|
29546
|
+
});
|
29547
|
+
}
|
29548
|
+
});
|
29549
|
+
}());
|
29550
|
+
(function() {
|
29551
|
+
$.extend(scrivito, {
|
29552
|
+
create_widget_command: function(cms_element) {
|
29553
|
+
var widgetlist_field_element, widget_element, description, obj_class;
|
29554
|
+
if (cms_element.widget_field) {
|
29555
|
+
widget_element = cms_element;
|
29556
|
+
widgetlist_field_element = widget_element.widget_field();
|
29557
|
+
} else {
|
29558
|
+
widgetlist_field_element = cms_element;
|
29559
|
+
}
|
29560
|
+
|
29561
|
+
obj_class = widgetlist_field_element.allowed_classes_for_create()[0];
|
29562
|
+
description = widgetlist_field_element.description_for_allowed_class(obj_class);
|
29563
|
+
|
29564
|
+
return scrivito.command.create_instance({
|
29565
|
+
id: 'scrivito.sdk.create_widget',
|
29566
|
+
title: scrivito.t('commands.create_widget.title', description),
|
29567
|
+
icon: '',
|
29568
|
+
|
29569
|
+
present: function() {
|
29570
|
+
return scrivito.editing_context.is_editing_mode() &&
|
29571
|
+
(widget_element || widgetlist_field_element.is_empty()) &&
|
29572
|
+
widgetlist_field_element.can_create_widget() &&
|
29573
|
+
!widgetlist_field_element.can_choose_widget_class();
|
29574
|
+
},
|
29575
|
+
|
29576
|
+
execute: function() {
|
29577
|
+
var widget_params = {create: {_obj_class: obj_class}};
|
29578
|
+
return scrivito.with_saving_overlay(
|
29579
|
+
widgetlist_field_element.add_widget(widget_params, widget_element)
|
29580
|
+
);
|
29425
29581
|
}
|
29426
29582
|
});
|
29427
29583
|
}
|
@@ -29498,12 +29654,12 @@ var scrivito = {};
|
|
29498
29654
|
confirm_button_text: scrivito.t('commands.delete_obj.dialog.confirm'),
|
29499
29655
|
confirm_button_color: 'red'
|
29500
29656
|
}).then(function() {
|
29501
|
-
return scrivito.with_saving_overlay(obj.destroy().then(function() {
|
29657
|
+
return scrivito.with_saving_overlay(obj.destroy().then(function(redirect_to) {
|
29502
29658
|
if (scrivito.obj_clipboard.is_present() &&
|
29503
29659
|
scrivito.obj_clipboard.obj().id() === obj.id()) {
|
29504
29660
|
scrivito.obj_clipboard.clear();
|
29505
29661
|
}
|
29506
|
-
return scrivito.redirect_to(
|
29662
|
+
return scrivito.redirect_to(redirect_to);
|
29507
29663
|
}));
|
29508
29664
|
});
|
29509
29665
|
}
|
@@ -29531,13 +29687,13 @@ var scrivito = {};
|
|
29531
29687
|
confirm_button_text: scrivito.t('commands.delete_widget.dialog.confirm'),
|
29532
29688
|
confirm_button_color: 'red'
|
29533
29689
|
}).then(function() {
|
29534
|
-
var
|
29690
|
+
var widgetlist_field_element = widget_element.widget_field();
|
29535
29691
|
var widget = widget_element.widget();
|
29536
29692
|
widget_element.dom_element().remove();
|
29537
|
-
if (
|
29693
|
+
if (widgetlist_field_element.is_empty()) {
|
29538
29694
|
scrivito.inplace_marker.refresh();
|
29539
29695
|
}
|
29540
|
-
scrivito.widget_sorting.update_placeholder(
|
29696
|
+
scrivito.widget_sorting.update_placeholder(widgetlist_field_element);
|
29541
29697
|
|
29542
29698
|
return widget.destroy().then(function() {
|
29543
29699
|
if (scrivito.widget_clipboard.is_present() &&
|
@@ -29714,7 +29870,6 @@ var scrivito = {};
|
|
29714
29870
|
scrivito.confirmation_dialog({
|
29715
29871
|
title: scrivito.t('commands.publish_workspace.error_dialog.title'),
|
29716
29872
|
description: scrivito.t('commands.publish_workspace.error_dialog.description'),
|
29717
|
-
color: 'red',
|
29718
29873
|
icon: '',
|
29719
29874
|
confirm_button_text: scrivito.t('commands.publish_workspace.error_dialog.confirm')
|
29720
29875
|
}).then(function() {
|
@@ -29775,7 +29930,14 @@ var scrivito = {};
|
|
29775
29930
|
|
29776
29931
|
execute: function() {
|
29777
29932
|
scrivito.with_saving_overlay(workspace.rebase().then(function() {
|
29778
|
-
return
|
29933
|
+
return workspace.has_conflicts().then(function() {
|
29934
|
+
return scrivito.confirmation_dialog({
|
29935
|
+
title: scrivito.t('commands.rebase_workspace.has_conflicts.title'),
|
29936
|
+
description: scrivito.t('commands.rebase_workspace.has_conflicts.description'),
|
29937
|
+
confirm_button_text: scrivito.t('commands.rebase_workspace.open_changes_dialog'),
|
29938
|
+
cancel_button_text: scrivito.t('close')
|
29939
|
+
}).done(function() { scrivito.changes_dialog.open(); });
|
29940
|
+
}).always(function() { return scrivito.application_window.reload(); });
|
29779
29941
|
}));
|
29780
29942
|
}
|
29781
29943
|
});
|
@@ -29898,7 +30060,7 @@ var scrivito = {};
|
|
29898
30060
|
},
|
29899
30061
|
|
29900
30062
|
update: function() {
|
29901
|
-
return obj.
|
30063
|
+
return obj.reload();
|
29902
30064
|
},
|
29903
30065
|
|
29904
30066
|
execute: function() {
|
@@ -29945,7 +30107,7 @@ var scrivito = {};
|
|
29945
30107
|
}
|
29946
30108
|
},
|
29947
30109
|
|
29948
|
-
update: function() { return widget.
|
30110
|
+
update: function() { return widget.reload(); },
|
29949
30111
|
|
29950
30112
|
execute: function() {
|
29951
30113
|
return scrivito.confirmation_dialog({
|
@@ -30204,9 +30366,10 @@ var scrivito = {};
|
|
30204
30366
|
if (!scrivito.editing_context.is_view_mode()) {
|
30205
30367
|
scrivito.on('content', function(content) {
|
30206
30368
|
_.each(scrivito.widget_element.all($(content)), function(widget_element) {
|
30207
|
-
var
|
30369
|
+
var widgetlist_field_element = widget_element.widget_field();
|
30208
30370
|
widget_element.set_menu([
|
30209
|
-
scrivito.
|
30371
|
+
scrivito.create_widget_command(widget_element),
|
30372
|
+
scrivito.choose_and_create_widget_command(widget_element),
|
30210
30373
|
//
|
30211
30374
|
// FIXME content-widget
|
30212
30375
|
//
|
@@ -30227,19 +30390,20 @@ var scrivito = {};
|
|
30227
30390
|
}());
|
30228
30391
|
(function() {
|
30229
30392
|
$.extend(scrivito, {
|
30230
|
-
|
30393
|
+
widgetlist_field_commands: {
|
30231
30394
|
init: function() {
|
30232
30395
|
if (scrivito.editing_context.is_editing_mode()) {
|
30233
30396
|
scrivito.on('content', function(content) {
|
30234
|
-
_.each(scrivito.
|
30235
|
-
|
30236
|
-
scrivito.
|
30397
|
+
_.each(scrivito.widgetlist_field_element.all($(content)), function(widgetlist_field_element) {
|
30398
|
+
widgetlist_field_element.set_menu([
|
30399
|
+
scrivito.create_widget_command(widgetlist_field_element),
|
30400
|
+
scrivito.choose_and_create_widget_command(widgetlist_field_element),
|
30237
30401
|
//
|
30238
30402
|
// FIXME content-widget
|
30239
30403
|
//
|
30240
|
-
// scrivito.add_content_command(
|
30241
|
-
scrivito.copy_widget_from_clipboard_command(
|
30242
|
-
].concat(
|
30404
|
+
// scrivito.add_content_command(widgetlist_field_element),
|
30405
|
+
scrivito.copy_widget_from_clipboard_command(widgetlist_field_element)
|
30406
|
+
].concat(widgetlist_field_element.menu()));
|
30243
30407
|
});
|
30244
30408
|
});
|
30245
30409
|
}
|
@@ -30266,13 +30430,13 @@ var scrivito = {};
|
|
30266
30430
|
}());
|
30267
30431
|
(function() {
|
30268
30432
|
$.extend(scrivito, {
|
30269
|
-
|
30433
|
+
widgetlist_field_marker: {
|
30270
30434
|
init: function() {
|
30271
30435
|
scrivito.inplace_marker.define(function(inplace_marker) {
|
30272
30436
|
if (scrivito.editing_context.is_editing_mode()) {
|
30273
|
-
_.each(scrivito.
|
30274
|
-
if (
|
30275
|
-
inplace_marker.activate_for(
|
30437
|
+
_.each(scrivito.widgetlist_field_element.all(), function(widgetlist_field_element) {
|
30438
|
+
if (widgetlist_field_element.is_empty()) {
|
30439
|
+
inplace_marker.activate_for(widgetlist_field_element);
|
30276
30440
|
}
|
30277
30441
|
});
|
30278
30442
|
}
|
@@ -30287,8 +30451,8 @@ var scrivito = {};
|
|
30287
30451
|
init: function() {
|
30288
30452
|
scrivito.inplace_marker.define(function(inplace_marker) {
|
30289
30453
|
if (scrivito.editing_context.selected_workspace.is_editable()) {
|
30290
|
-
_.each(scrivito.
|
30291
|
-
_.each(
|
30454
|
+
_.each(scrivito.widgetlist_field_element.all(), function(widgetlist_field_element) {
|
30455
|
+
_.each(widgetlist_field_element.widget_elements(), function(widget_element) {
|
30292
30456
|
var show_as_modified = widget_element.widget().is_modified() ||
|
30293
30457
|
widget_element.widget().is_placement_modified();
|
30294
30458
|
if (scrivito.editing_context.is_editing_mode() ||
|
@@ -30424,10 +30588,10 @@ var scrivito = {};
|
|
30424
30588
|
|
30425
30589
|
var widget_element = scrivito.cms_element.from_dom_element(ui.item);
|
30426
30590
|
var widget_class_name = widget_element.widget().widget_class_name();
|
30427
|
-
_.each(
|
30428
|
-
var dom_element = cms_document.local_jquery(
|
30591
|
+
_.each(widgetlist_field_elements, function(widgetlist_field_element) {
|
30592
|
+
var dom_element = cms_document.local_jquery(widgetlist_field_element.dom_element());
|
30429
30593
|
if (dom_element.data('ui-sortable')) {
|
30430
|
-
if (
|
30594
|
+
if (widgetlist_field_element.is_valid_child_class(widget_class_name)) {
|
30431
30595
|
dom_element.addClass('scrivito_widget_drop_allowed');
|
30432
30596
|
} else {
|
30433
30597
|
dom_element.sortable('disable');
|
@@ -30443,8 +30607,8 @@ var scrivito = {};
|
|
30443
30607
|
|
30444
30608
|
// Drag the _last_ widget out of a widget field and then drop it back.
|
30445
30609
|
if (!ui.sender) {
|
30446
|
-
var
|
30447
|
-
scrivito.widget_sorting.update_placeholder(
|
30610
|
+
var widgetlist_field_element = scrivito.cms_element.from_dom_element(ui.item).widget_field();
|
30611
|
+
scrivito.widget_sorting.update_placeholder(widgetlist_field_element);
|
30448
30612
|
}
|
30449
30613
|
|
30450
30614
|
scrivito.inplace_marker.refresh();
|
@@ -30479,19 +30643,19 @@ var scrivito = {};
|
|
30479
30643
|
// The bug in http://bugs.jqueryui.com/ticket/5671 is still present.
|
30480
30644
|
over: function(event, ui) {
|
30481
30645
|
if (ui.sender) {
|
30482
|
-
var
|
30646
|
+
var widgetlist_field_element = scrivito.cms_element.from_dom_element(ui.sender);
|
30483
30647
|
// If "over" is triggered, then exactly one item has been removed from the sender field.
|
30484
|
-
var number_of_widget_elements =
|
30485
|
-
scrivito.widget_sorting.update_placeholder(
|
30648
|
+
var number_of_widget_elements = widgetlist_field_element.widget_elements().length - 1;
|
30649
|
+
scrivito.widget_sorting.update_placeholder(widgetlist_field_element,
|
30486
30650
|
number_of_widget_elements);
|
30487
30651
|
}
|
30488
30652
|
},
|
30489
30653
|
|
30490
|
-
update_placeholder: function(
|
30491
|
-
var dom_element =
|
30654
|
+
update_placeholder: function(widgetlist_field_element, number_of_widget_elements) {
|
30655
|
+
var dom_element = widgetlist_field_element.dom_element();
|
30492
30656
|
|
30493
30657
|
if (number_of_widget_elements === undefined) {
|
30494
|
-
number_of_widget_elements =
|
30658
|
+
number_of_widget_elements = widgetlist_field_element.widget_elements().length;
|
30495
30659
|
}
|
30496
30660
|
|
30497
30661
|
if (number_of_widget_elements === 0) {
|
@@ -30503,21 +30667,21 @@ var scrivito = {};
|
|
30503
30667
|
}
|
30504
30668
|
});
|
30505
30669
|
|
30506
|
-
var
|
30670
|
+
var widgetlist_field_elements = [];
|
30507
30671
|
var widget_field_dom_elements = [];
|
30508
30672
|
|
30509
30673
|
var create = function(root_element) {
|
30510
30674
|
var cms_document = scrivito.cms_document.from(root_element);
|
30511
30675
|
|
30512
30676
|
if (scrivito.editing_context.visible_workspace.is_editable()) {
|
30513
|
-
_.each(scrivito.
|
30514
|
-
var dom_element = cms_document.local_jquery(
|
30677
|
+
_.each(scrivito.widgetlist_field_element.all(root_element), function(widgetlist_field_element) {
|
30678
|
+
var dom_element = cms_document.local_jquery(widgetlist_field_element.dom_element());
|
30515
30679
|
if (!dom_element.data('ui-sortable')) {
|
30516
30680
|
dom_element.sortable({
|
30517
30681
|
items: '> [data-scrivito-private-widget-id]',
|
30518
30682
|
handle: '> .scrivito_editing_marker',
|
30519
30683
|
placeholder: 'scrivito_widget_drop_placeholder',
|
30520
|
-
connectWith: '*[data-scrivito-field-type="
|
30684
|
+
connectWith: '*[data-scrivito-field-type="widgetlist"]',
|
30521
30685
|
|
30522
30686
|
start: scrivito.widget_sorting.start,
|
30523
30687
|
stop: scrivito.widget_sorting.stop,
|
@@ -30529,32 +30693,32 @@ var scrivito = {};
|
|
30529
30693
|
tolerance: 'pointer' // jQuery fails to correctly determine the intersection.
|
30530
30694
|
});
|
30531
30695
|
|
30532
|
-
scrivito.widget_sorting.update_placeholder(
|
30696
|
+
scrivito.widget_sorting.update_placeholder(widgetlist_field_element);
|
30533
30697
|
|
30534
|
-
|
30698
|
+
widgetlist_field_elements.push(widgetlist_field_element);
|
30535
30699
|
widget_field_dom_elements.push(dom_element);
|
30536
30700
|
}
|
30537
30701
|
});
|
30538
30702
|
}
|
30539
30703
|
};
|
30540
30704
|
|
30541
|
-
var add_changes = function(changes,
|
30542
|
-
var parent_widget =
|
30705
|
+
var add_changes = function(changes, widgetlist_field_element) {
|
30706
|
+
var parent_widget = widgetlist_field_element.parent_widget();
|
30543
30707
|
if (parent_widget) {
|
30544
|
-
add_widget_changes(changes,
|
30708
|
+
add_widget_changes(changes, widgetlist_field_element, parent_widget.id());
|
30545
30709
|
} else {
|
30546
|
-
add_field_changes(changes,
|
30710
|
+
add_field_changes(changes, widgetlist_field_element);
|
30547
30711
|
}
|
30548
30712
|
};
|
30549
30713
|
|
30550
|
-
var add_field_changes = function(changes,
|
30551
|
-
changes[
|
30714
|
+
var add_field_changes = function(changes, widgetlist_field_element) {
|
30715
|
+
changes[widgetlist_field_element.field_name()] = widgetlist_field_element.content();
|
30552
30716
|
};
|
30553
30717
|
|
30554
|
-
var add_widget_changes = function(changes,
|
30718
|
+
var add_widget_changes = function(changes, widgetlist_field_element, parent_widget_id) {
|
30555
30719
|
if (!changes._widget_pool) { changes._widget_pool = {}; }
|
30556
30720
|
if (!changes._widget_pool[parent_widget_id]) { changes._widget_pool[parent_widget_id] = {}; }
|
30557
|
-
add_field_changes(changes._widget_pool[parent_widget_id],
|
30721
|
+
add_field_changes(changes._widget_pool[parent_widget_id], widgetlist_field_element);
|
30558
30722
|
};
|
30559
30723
|
}());
|
30560
30724
|
(function() {
|
@@ -30563,8 +30727,8 @@ var scrivito = {};
|
|
30563
30727
|
init: function() {
|
30564
30728
|
scrivito.on('content', function(content) {
|
30565
30729
|
if (scrivito.in_editable_view()) {
|
30566
|
-
_.each(scrivito.
|
30567
|
-
scrivito.content_upload.create(
|
30730
|
+
_.each(scrivito.widgetlist_field_element.all($(content)), function(widgetlist_field_element) {
|
30731
|
+
scrivito.content_upload.create(widgetlist_field_element);
|
30568
30732
|
});
|
30569
30733
|
|
30570
30734
|
_.each(scrivito.widget_element.all($(content)), function(widget_element) {
|
@@ -30574,9 +30738,9 @@ var scrivito = {};
|
|
30574
30738
|
});
|
30575
30739
|
},
|
30576
30740
|
|
30577
|
-
create: function(
|
30578
|
-
var dropzone = (widget_element ||
|
30579
|
-
var is_active = function() { return widget_element ||
|
30741
|
+
create: function(widgetlist_field_element, widget_element) {
|
30742
|
+
var dropzone = (widget_element || widgetlist_field_element).dom_element();
|
30743
|
+
var is_active = function() { return widget_element || widgetlist_field_element.is_empty(); };
|
30580
30744
|
|
30581
30745
|
dropzone.on('dragenter', function() {
|
30582
30746
|
if (is_active()) {
|
@@ -30599,7 +30763,7 @@ var scrivito = {};
|
|
30599
30763
|
if (data_transfer) {
|
30600
30764
|
var files = data_transfer.files;
|
30601
30765
|
if (files.length === 1) {
|
30602
|
-
scrivito.content_upload.upload(files[0],
|
30766
|
+
scrivito.content_upload.upload(files[0], widgetlist_field_element, widget_element);
|
30603
30767
|
}
|
30604
30768
|
}
|
30605
30769
|
}
|
@@ -30607,21 +30771,14 @@ var scrivito = {};
|
|
30607
30771
|
});
|
30608
30772
|
},
|
30609
30773
|
|
30610
|
-
upload: function(file,
|
30774
|
+
upload: function(file, widgetlist_field_element, widget_element) {
|
30611
30775
|
var name = file.name.replace(/[^a-z0-9_.$\-]/ig, '-');
|
30612
30776
|
var path = '_resources/'+Math.floor(Math.random() * 1000)+'/'+name;
|
30613
30777
|
var obj_class = scrivito.default_obj_class_for_content_type(file.type);
|
30614
30778
|
|
30615
30779
|
var create_obj = scrivito.create_obj({blob: file, _path: path, _obj_class: obj_class});
|
30616
30780
|
scrivito.with_saving_overlay(create_obj.then(function(obj) {
|
30617
|
-
|
30618
|
-
return create_widget.then(function(widget) {
|
30619
|
-
return widget.fetch_show_markup().then(function(markup) {
|
30620
|
-
var dom_element = widget_field_element.prepend_widget_markup(markup, widget_element);
|
30621
|
-
scrivito.ensure_fully_visible_within_application_window(dom_element);
|
30622
|
-
scrivito.widget_sorting.update_placeholder(widget_field_element);
|
30623
|
-
});
|
30624
|
-
});
|
30781
|
+
return widgetlist_field_element.create_content_widget(obj.id, widget_element);
|
30625
30782
|
}));
|
30626
30783
|
}
|
30627
30784
|
}
|
@@ -31015,6 +31172,7 @@ var scrivito = {};
|
|
31015
31172
|
|
31016
31173
|
|
31017
31174
|
|
31175
|
+
|
31018
31176
|
|
31019
31177
|
|
31020
31178
|
//
|