infopark_cloud_connector 6.9.2.1.125136549 → 6.9.3.1.36404185
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.
- data/README +4 -2
- data/app/controllers/rails_connector/objs_controller.rb +35 -18
- data/app/helpers/rails_connector/cms_tag_helper.rb +5 -15
- data/app/helpers/rails_connector/display_helper.rb +105 -0
- data/app/helpers/rails_connector/editing_helper.rb +6 -0
- data/app/views/rails_connector/_editing_javascript.html.erb +2 -1
- data/config/ca-bundle.crt +3509 -0
- data/config/routes.rb +1 -0
- data/lib/assets/javascripts/infopark_editing.js +488 -208
- data/lib/assets/stylesheets/infopark_editing.css +71 -2
- data/lib/rails_connector/basic_obj.rb +46 -6
- data/lib/rails_connector/cms_rest_api.rb +26 -14
- data/lib/rails_connector/configuration.rb +199 -0
- data/lib/rails_connector/content_service.rb +27 -8
- data/lib/rails_connector/link.rb +0 -8
- data/lib/rails_connector/obj_data_from_hash.rb +3 -2
- metadata +6 -3
@@ -12989,50 +12989,22 @@ function program1(depth0,data) {
|
|
12989
12989
|
});
|
12990
12990
|
return this.InfoparkHandlebarsTemplates["confirmation_dialog"];
|
12991
12991
|
}).call(this);
|
12992
|
-
(function() {
|
12993
|
-
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
12994
|
-
this.InfoparkHandlebarsTemplates["deactivate_menu_bar_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
12995
|
-
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
|
12996
|
-
helpers = helpers || Handlebars.helpers; data = data || {};
|
12997
|
-
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
12998
|
-
|
12999
|
-
|
13000
|
-
buffer += "<i class=\"ip_icon\" title=\"";
|
13001
|
-
options = {hash:{},data:data};
|
13002
|
-
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.deactivate_editing", options) : helperMissing.call(depth0, "translate", "menu_bar.deactivate_editing", options)))
|
13003
|
-
+ "\"></i>\n";
|
13004
|
-
return buffer;
|
13005
|
-
});
|
13006
|
-
return this.InfoparkHandlebarsTemplates["deactivate_menu_bar_item"];
|
13007
|
-
}).call(this);
|
13008
|
-
(function() {
|
13009
|
-
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13010
|
-
this.InfoparkHandlebarsTemplates["delete_current_page_item"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
13011
|
-
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
|
13012
|
-
helpers = helpers || Handlebars.helpers; data = data || {};
|
13013
|
-
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
13014
|
-
|
13015
|
-
|
13016
|
-
buffer += "<i class=\"ip_icon\"></i>\n<span class=\"ip_button_label\">";
|
13017
|
-
options = {hash:{},data:data};
|
13018
|
-
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar.delete_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar.delete_current_page", options)))
|
13019
|
-
+ "</span>\n";
|
13020
|
-
return buffer;
|
13021
|
-
});
|
13022
|
-
return this.InfoparkHandlebarsTemplates["delete_current_page_item"];
|
13023
|
-
}).call(this);
|
13024
12992
|
(function() {
|
13025
12993
|
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13026
12994
|
this.InfoparkHandlebarsTemplates["edit_dialog"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
13027
12995
|
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
|
13028
12996
|
helpers = helpers || Handlebars.helpers; data = data || {};
|
13029
|
-
var buffer = "", stack1, stack2, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression
|
12997
|
+
var buffer = "", stack1, stack2, options, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
13030
12998
|
|
13031
12999
|
|
13032
|
-
buffer += "<div class=\"ip_edit_dialog ip_modal_big ip_adjust_dialog\">\n\n <div class=\"ip_modal_header\">\n <h3><i class=\"ip_icon\"
|
13000
|
+
buffer += "<div class=\"ip_edit_dialog ip_modal_big ip_adjust_dialog\">\n\n <div class=\"ip_modal_header\">\n <h3><i class=\"ip_icon\">";
|
13001
|
+
if (stack1 = helpers.icon) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
13002
|
+
else { stack1 = depth0.icon; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
13003
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
13004
|
+
buffer += "</i>";
|
13033
13005
|
options = {hash:{},data:data};
|
13034
13006
|
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "edit_dialog.title", depth0.title, options) : helperMissing.call(depth0, "translate", "edit_dialog.title", depth0.title, options)))
|
13035
|
-
+ "</h3>\n </div>\n\n <div class=\"ip_modal_body ip_auto_height\">";
|
13007
|
+
+ "</h3>\n <div class=\"ip_edit_dialog_saving_indicator\"></div>\n </div>\n\n <div class=\"ip_modal_body ip_edit_dialog_markup ip_auto_height\">";
|
13036
13008
|
if (stack2 = helpers.markup) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
|
13037
13009
|
else { stack2 = depth0.markup; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
|
13038
13010
|
if(stack2 || stack2 === 0) { buffer += stack2; }
|
@@ -13151,10 +13123,53 @@ helpers = helpers || Handlebars.helpers; data = data || {};
|
|
13151
13123
|
|
13152
13124
|
|
13153
13125
|
|
13154
|
-
return "<div class=\"ip_topbar\">\n <div class=\"ip_first_level\">\n <div class=\"ip_button_bar ip_app ip_no_hover\">\n <span class=\"ip_logo\"></span>\n <span class=\"ip_product_name\">CMS</span>\n </div>\n\n <div id=\"ip_select_workspace\" class=\"ip_button_bar\"></div>\n <div id=\"
|
13126
|
+
return "<div class=\"ip_topbar\">\n <div class=\"ip_first_level\">\n <div class=\"ip_button_bar ip_app ip_no_hover\">\n <span class=\"ip_logo\"></span>\n <span class=\"ip_product_name\">CMS</span>\n </div>\n\n <div id=\"ip_select_workspace\" class=\"ip_button_bar\"></div>\n <div id=\"ip_menu_bar_dropdown\" class=\"ip_button_bar ip_right\"></div>\n <div id=\"ip_menu_bar_saving_indicator\"></div>\n </div>\n</div>\n";
|
13155
13127
|
});
|
13156
13128
|
return this.InfoparkHandlebarsTemplates["menu_bar"];
|
13157
13129
|
}).call(this);
|
13130
|
+
(function() {
|
13131
|
+
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13132
|
+
this.InfoparkHandlebarsTemplates["menu_bar_dropdown"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
13133
|
+
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
|
13134
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
13135
|
+
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, self=this;
|
13136
|
+
|
13137
|
+
function program1(depth0,data) {
|
13138
|
+
|
13139
|
+
var buffer = "", stack1, options;
|
13140
|
+
buffer += "\n ";
|
13141
|
+
stack1 = helpers['if'].call(depth0, depth0.current_page_has_edit_view, {hash:{},inverse:self.noop,fn:self.program(2, program2, data),data:data});
|
13142
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
13143
|
+
buffer += "\n\n <li id=\"ip_delete_current_page\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\"></i>";
|
13144
|
+
options = {hash:{},data:data};
|
13145
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.delete_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.delete_current_page", options)))
|
13146
|
+
+ "</span>\n </li>\n\n <li id=\"ip_open_current_page_in_admin_gui\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\"></i>";
|
13147
|
+
options = {hash:{},data:data};
|
13148
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.open_current_page_in_admin_gui", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.open_current_page_in_admin_gui", options)))
|
13149
|
+
+ "</span>\n </li>\n ";
|
13150
|
+
return buffer;
|
13151
|
+
}
|
13152
|
+
function program2(depth0,data) {
|
13153
|
+
|
13154
|
+
var buffer = "", stack1, options;
|
13155
|
+
buffer += "\n <li id=\"ip_edit_current_page\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\"></i>";
|
13156
|
+
options = {hash:{},data:data};
|
13157
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.edit_current_page", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.edit_current_page", options)))
|
13158
|
+
+ "</span>\n </li>\n ";
|
13159
|
+
return buffer;
|
13160
|
+
}
|
13161
|
+
|
13162
|
+
buffer += "<i class=\"ip_icon\"></i>\n\n<ul class=\"ip_menu_box ip_right\" style=\"display: none;\">\n ";
|
13163
|
+
stack1 = helpers['if'].call(depth0, depth0.has_current_page, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
13164
|
+
if(stack1 || stack1 === 0) { buffer += stack1; }
|
13165
|
+
buffer += "\n\n <li id=\"ip_deactivate_editing\" class=\"ip_menu_item\">\n <span><i class=\"ip_icon\"></i>";
|
13166
|
+
options = {hash:{},data:data};
|
13167
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "menu_bar_dropdown.deactivate_editing", options) : helperMissing.call(depth0, "translate", "menu_bar_dropdown.deactivate_editing", options)))
|
13168
|
+
+ "</span>\n </li>\n</ul>\n";
|
13169
|
+
return buffer;
|
13170
|
+
});
|
13171
|
+
return this.InfoparkHandlebarsTemplates["menu_bar_dropdown"];
|
13172
|
+
}).call(this);
|
13158
13173
|
(function() {
|
13159
13174
|
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13160
13175
|
this.InfoparkHandlebarsTemplates["overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
@@ -13217,6 +13232,25 @@ function program1(depth0,data) {
|
|
13217
13232
|
});
|
13218
13233
|
return this.InfoparkHandlebarsTemplates["prompt_dialog"];
|
13219
13234
|
}).call(this);
|
13235
|
+
(function() {
|
13236
|
+
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13237
|
+
this.InfoparkHandlebarsTemplates["saving_indicator"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
13238
|
+
this.compilerInfo = [2,'>= 1.0.0-rc.3'];
|
13239
|
+
helpers = helpers || Handlebars.helpers; data = data || {};
|
13240
|
+
var buffer = "", stack1, options, helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
13241
|
+
|
13242
|
+
|
13243
|
+
buffer += "<span class=\"ip_saving_indicator ip_saving_state_bar\">\n <span class=\"ip_saving_in_progress\" style=\"display:none;\">\n <i class=\"ip_icon ip_spinning\"></i>\n <span class=\"ip_button_label\"><span>";
|
13244
|
+
options = {hash:{},data:data};
|
13245
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "saving_indicator_item.saving", options) : helperMissing.call(depth0, "translate", "saving_indicator_item.saving", options)))
|
13246
|
+
+ "</span></span>\n </span>\n\n <span class=\"ip_saving_done\">\n <i class=\"ip_icon\"></i>\n <span class=\"ip_button_label\"><span>";
|
13247
|
+
options = {hash:{},data:data};
|
13248
|
+
buffer += escapeExpression(((stack1 = helpers.translate),stack1 ? stack1.call(depth0, "saving_indicator_item.saved", options) : helperMissing.call(depth0, "translate", "saving_indicator_item.saved", options)))
|
13249
|
+
+ "</span></span>\n </span>\n</div>\n";
|
13250
|
+
return buffer;
|
13251
|
+
});
|
13252
|
+
return this.InfoparkHandlebarsTemplates["saving_indicator"];
|
13253
|
+
}).call(this);
|
13220
13254
|
(function() {
|
13221
13255
|
this.InfoparkHandlebarsTemplates || (this.InfoparkHandlebarsTemplates = {});
|
13222
13256
|
this.InfoparkHandlebarsTemplates["saving_overlay"] = Handlebars.template(function (Handlebars,depth0,helpers,partials,data) {
|
@@ -13413,6 +13447,7 @@ $.i18n().load({
|
|
13413
13447
|
'accept': 'Übernehmen',
|
13414
13448
|
'close': 'Schließen',
|
13415
13449
|
'loading': 'Lade...',
|
13450
|
+
'current_page': 'Aktuelle Seite',
|
13416
13451
|
|
13417
13452
|
'choose_obj_class_dialog.add_child_page.title': 'Seitenvorlage auswählen',
|
13418
13453
|
'choose_obj_class_dialog.add_widget.title': 'Widget auswählen',
|
@@ -13426,7 +13461,6 @@ $.i18n().load({
|
|
13426
13461
|
|
13427
13462
|
'edit_dialog.title': '$1 bearbeiten',
|
13428
13463
|
|
13429
|
-
'menu_bar.deactivate_editing': 'Direktbearbeitung deaktivieren',
|
13430
13464
|
'menu_bar.working_copy': 'Arbeitskopie',
|
13431
13465
|
'menu_bar.empty_workspace_title': '<leerer Titel>',
|
13432
13466
|
'menu_bar.published_workspace_title': 'Veröffentlichte Inhalte',
|
@@ -13447,21 +13481,30 @@ $.i18n().load({
|
|
13447
13481
|
'menu_bar.create_new_ws_confirmation': 'Arbeitskopie anlegen',
|
13448
13482
|
'menu_bar.create_new_ws_confirmation_desc': 'Bitte geben Sie den Titel der neuen Arbeitskopie ein.',
|
13449
13483
|
'menu_bar.create_new_ws_confirmation_placeholder': 'Neuer Titel',
|
13450
|
-
|
13484
|
+
|
13485
|
+
'menu_bar_dropdown.edit_current_page': 'Diese Seite bearbeiten',
|
13486
|
+
'menu_bar_dropdown.delete_current_page': 'Diese Seite löschen',
|
13487
|
+
'menu_bar_dropdown.open_current_page_in_admin_gui': 'Im Admin-GUI öffnen',
|
13488
|
+
'menu_bar_dropdown.deactivate_editing': 'Direktbearbeitung deaktivieren',
|
13489
|
+
|
13490
|
+
'saving_indicator_item.saving': 'Wird gespeichert...',
|
13491
|
+
'saving_indicator_item.saved': 'Alle Änderungen gespeichert',
|
13451
13492
|
|
13452
13493
|
'child_list_menus.add_subpage': 'Neue Seite anlegen',
|
13453
13494
|
|
13454
13495
|
'widget_menus.add_widget': 'Widget einfügen',
|
13455
13496
|
'widget_menus.edit_widget': 'Widget bearbeiten',
|
13456
13497
|
'widget_menus.delete_widget': 'Widget löschen',
|
13457
|
-
'widget_menus.open_in_admin_gui': '
|
13498
|
+
'widget_menus.open_in_admin_gui': 'Im Admin-GUI öffnen',
|
13458
13499
|
|
13459
13500
|
'commands.delete_obj.confirm_title': 'Wirklich diese Seite löschen?',
|
13460
13501
|
'commands.delete_obj.confirm_description': 'Eine gelöschte Seite kann nicht wiederhergestellt werden.',
|
13461
13502
|
'commands.delete_widget.confirm_title': 'Wirklich dieses Widget löschen?',
|
13462
13503
|
'commands.delete_widget.confirm_description': 'Ein gelöschtes Widget kann nicht wiederhergestellt werden.',
|
13463
13504
|
|
13464
|
-
'image_upload.too_many_files': 'Nur eine Detei erlaubt.'
|
13505
|
+
'image_upload.too_many_files': 'Nur eine Detei erlaubt.',
|
13506
|
+
|
13507
|
+
'warn_before_unloading': 'Sie haben ungespeicherte Änderungen! Sind Sie sicher, dass sie schließen wollen?'
|
13465
13508
|
}, 'de');
|
13466
13509
|
$.i18n().load({
|
13467
13510
|
'confirm': 'Confirm',
|
@@ -13472,6 +13515,7 @@ $.i18n().load({
|
|
13472
13515
|
'accept': 'Accept',
|
13473
13516
|
'close': 'Close',
|
13474
13517
|
'load': 'Loading...',
|
13518
|
+
'current_page': 'current page',
|
13475
13519
|
|
13476
13520
|
'choose_obj_class_dialog.add_child_page.title': 'Select Page Type',
|
13477
13521
|
'choose_obj_class_dialog.add_widget.title': 'Select Widget',
|
@@ -13485,7 +13529,6 @@ $.i18n().load({
|
|
13485
13529
|
|
13486
13530
|
'edit_dialog.title': 'Edit $1',
|
13487
13531
|
|
13488
|
-
'menu_bar.deactivate_editing': 'deactivate in-place editing',
|
13489
13532
|
'menu_bar.working_copy': 'Working copy',
|
13490
13533
|
'menu_bar.empty_workspace_title': '<empty title>',
|
13491
13534
|
'menu_bar.published_workspace_title': 'Published content',
|
@@ -13506,7 +13549,14 @@ $.i18n().load({
|
|
13506
13549
|
'menu_bar.create_new_ws_confirmation': 'Create a working copy',
|
13507
13550
|
'menu_bar.create_new_ws_confirmation_desc': 'Please enter the title of the new working copy.',
|
13508
13551
|
'menu_bar.create_new_ws_confirmation_placeholder': 'new title',
|
13509
|
-
|
13552
|
+
|
13553
|
+
'menu_bar_dropdown.edit_current_page': 'Edit this page',
|
13554
|
+
'menu_bar_dropdown.delete_current_page': 'Delete this page',
|
13555
|
+
'menu_bar_dropdown.open_current_page_in_admin_gui': 'Open in admin GUI',
|
13556
|
+
'menu_bar_dropdown.deactivate_editing': 'Deactivate in-place editing',
|
13557
|
+
|
13558
|
+
'saving_indicator_item.saving': 'Saving...',
|
13559
|
+
'saving_indicator_item.saved': 'All changes saved',
|
13510
13560
|
|
13511
13561
|
'child_list_menus.add_subpage': 'Create new page',
|
13512
13562
|
|
@@ -13520,7 +13570,9 @@ $.i18n().load({
|
|
13520
13570
|
'commands.delete_widget.confirm_title': 'Really delete this widget?',
|
13521
13571
|
'commands.delete_widget.confirm_description': 'A deleted widget cannot be restored.',
|
13522
13572
|
|
13523
|
-
'image_upload.too_many_files': 'Only one file allowed.'
|
13573
|
+
'image_upload.too_many_files': 'Only one file allowed.',
|
13574
|
+
|
13575
|
+
'warn_before_unloading': 'You have unsaved changes. Are you sure you want to quit?'
|
13524
13576
|
}, 'en');
|
13525
13577
|
/*global alert:false */
|
13526
13578
|
|
@@ -13558,7 +13610,11 @@ var infopark = {
|
|
13558
13610
|
},
|
13559
13611
|
|
13560
13612
|
reload: function() {
|
13561
|
-
infopark.
|
13613
|
+
if (infopark.write_monitor.is_writing()) {
|
13614
|
+
infopark.write_monitor.on('end_write', function() { infopark.reload(); });
|
13615
|
+
} else {
|
13616
|
+
infopark.reload_location();
|
13617
|
+
}
|
13562
13618
|
return $.Deferred();
|
13563
13619
|
},
|
13564
13620
|
|
@@ -13633,14 +13689,28 @@ var infopark = {
|
|
13633
13689
|
}
|
13634
13690
|
});
|
13635
13691
|
} else if (event === 'new_content') {
|
13636
|
-
infopark.editing.on('refresh', function(
|
13637
|
-
if (
|
13638
|
-
callback(
|
13692
|
+
infopark.editing.on('refresh', function(dom_element) {
|
13693
|
+
if (dom_element) {
|
13694
|
+
callback(dom_element);
|
13639
13695
|
}
|
13640
13696
|
});
|
13641
13697
|
} else {
|
13642
13698
|
$.error('Unknown event "' + event + '"');
|
13643
13699
|
}
|
13700
|
+
},
|
13701
|
+
|
13702
|
+
create_obj: function(attributes) {
|
13703
|
+
return infopark.obj.create(attributes).then(function(obj) {
|
13704
|
+
return {id: obj.id()};
|
13705
|
+
});
|
13706
|
+
},
|
13707
|
+
|
13708
|
+
delete_obj: function(id) {
|
13709
|
+
if (id) {
|
13710
|
+
return infopark.obj.create_instance(id).destroy();
|
13711
|
+
} else {
|
13712
|
+
$.error("Can't delete without ID");
|
13713
|
+
}
|
13644
13714
|
}
|
13645
13715
|
};
|
13646
13716
|
(function() {
|
@@ -13669,25 +13739,51 @@ var infopark = {
|
|
13669
13739
|
});
|
13670
13740
|
}());
|
13671
13741
|
(function() {
|
13742
|
+
var assert_valid_dom_element = function(dom_element) {
|
13743
|
+
if (dom_element.length > 0) {
|
13744
|
+
if (dom_element.length === 1) {
|
13745
|
+
return true;
|
13746
|
+
} else {
|
13747
|
+
$.error('Can not call "infopark" method on more than one tag');
|
13748
|
+
}
|
13749
|
+
}
|
13750
|
+
};
|
13751
|
+
|
13752
|
+
var build_cms_field_element = function(dom_element) {
|
13753
|
+
var cms_field_element = infopark.cms_element.from_dom_element(dom_element);
|
13754
|
+
if (cms_field_element) {
|
13755
|
+
return cms_field_element;
|
13756
|
+
} else {
|
13757
|
+
$.error('Can not call "infopark" method on a non-cms tag');
|
13758
|
+
}
|
13759
|
+
};
|
13760
|
+
|
13761
|
+
var save_content = function(dom_element, content) {
|
13762
|
+
if (assert_valid_dom_element(dom_element)) {
|
13763
|
+
if (content === undefined || content === null) {
|
13764
|
+
$.error('Can not call "save" with no content');
|
13765
|
+
} else {
|
13766
|
+
var cms_field_element = build_cms_field_element(dom_element);
|
13767
|
+
return cms_field_element.save(content).then(function() {
|
13768
|
+
cms_field_element.set_original_content(content);
|
13769
|
+
});
|
13770
|
+
}
|
13771
|
+
}
|
13772
|
+
};
|
13773
|
+
|
13774
|
+
var get_original_content = function(dom_element) {
|
13775
|
+
if (assert_valid_dom_element(dom_element)) {
|
13776
|
+
return build_cms_field_element(dom_element).original_content();
|
13777
|
+
} else {
|
13778
|
+
$.error('Can not call "infopark" method on an empty element');
|
13779
|
+
}
|
13780
|
+
};
|
13781
|
+
|
13672
13782
|
$.fn.infopark = function(method, content) {
|
13673
13783
|
if (method === 'save') {
|
13674
|
-
|
13675
|
-
|
13676
|
-
|
13677
|
-
var cms_field_element = infopark.cms_element.from_dom_element(dom_element);
|
13678
|
-
if (cms_field_element) {
|
13679
|
-
if (content === undefined || content === null) {
|
13680
|
-
$.error('Can not call "save" with no content');
|
13681
|
-
} else {
|
13682
|
-
return cms_field_element.save(content);
|
13683
|
-
}
|
13684
|
-
} else {
|
13685
|
-
$.error('Can not call "save" on a non-cms tag');
|
13686
|
-
}
|
13687
|
-
} else {
|
13688
|
-
$.error('Can not call "save" on more than one tag');
|
13689
|
-
}
|
13690
|
-
}
|
13784
|
+
return save_content($(this), content);
|
13785
|
+
} else if (method === 'content') {
|
13786
|
+
return get_original_content($(this));
|
13691
13787
|
} else {
|
13692
13788
|
$.error('Unknown method "' + method + '"');
|
13693
13789
|
}
|
@@ -13730,10 +13826,10 @@ var infopark = {
|
|
13730
13826
|
infopark.reload();
|
13731
13827
|
},
|
13732
13828
|
|
13733
|
-
refresh: function(
|
13829
|
+
refresh: function(dom_element) {
|
13734
13830
|
_.each($(event_handlers.refresh), function(handler) {
|
13735
|
-
if (
|
13736
|
-
handler(
|
13831
|
+
if (dom_element) {
|
13832
|
+
handler(dom_element);
|
13737
13833
|
} else if (handler.length === 0) {
|
13738
13834
|
handler();
|
13739
13835
|
}
|
@@ -13812,13 +13908,81 @@ var infopark = {
|
|
13812
13908
|
|
13813
13909
|
$.extend(infopark, {
|
13814
13910
|
ajax: function(type, path, options) {
|
13815
|
-
|
13911
|
+
var is_write_request = type === 'PUT' || type === 'POST' || type === 'DELETE';
|
13912
|
+
if (is_write_request) {
|
13913
|
+
infopark.write_monitor.start_write();
|
13914
|
+
}
|
13915
|
+
|
13916
|
+
var ajax_promise = single_ajax(type, path, options).then(function(result) {
|
13816
13917
|
if (result && result.task && _.size(result) === 1) {
|
13817
13918
|
return handle_task(result.task);
|
13818
13919
|
} else {
|
13819
13920
|
return $.Deferred().resolve(result);
|
13820
13921
|
}
|
13821
13922
|
});
|
13923
|
+
|
13924
|
+
if (is_write_request) {
|
13925
|
+
return ajax_promise.always(function() {
|
13926
|
+
infopark.write_monitor.end_write();
|
13927
|
+
});
|
13928
|
+
} else {
|
13929
|
+
return ajax_promise;
|
13930
|
+
}
|
13931
|
+
}
|
13932
|
+
});
|
13933
|
+
}());
|
13934
|
+
(function() {
|
13935
|
+
var callbacks = {};
|
13936
|
+
var current_token = 0;
|
13937
|
+
var counter = 0;
|
13938
|
+
|
13939
|
+
var run_callbacks = function(event_name) {
|
13940
|
+
_.each(callbacks[event_name], function(callback) {
|
13941
|
+
callback();
|
13942
|
+
});
|
13943
|
+
};
|
13944
|
+
|
13945
|
+
$.extend(infopark, {
|
13946
|
+
write_monitor: {
|
13947
|
+
on: function(event_name, callback) {
|
13948
|
+
if (callbacks[event_name] === undefined) {
|
13949
|
+
callbacks[event_name] = {};
|
13950
|
+
}
|
13951
|
+
current_token += 1;
|
13952
|
+
callbacks[event_name][current_token] = callback;
|
13953
|
+
return current_token;
|
13954
|
+
},
|
13955
|
+
|
13956
|
+
off: function(token) {
|
13957
|
+
_.each(callbacks, function(event_callbacks) {
|
13958
|
+
delete event_callbacks[token];
|
13959
|
+
});
|
13960
|
+
},
|
13961
|
+
|
13962
|
+
is_writing: function() {
|
13963
|
+
return counter > 0;
|
13964
|
+
},
|
13965
|
+
|
13966
|
+
start_write: function() {
|
13967
|
+
run_callbacks('start_write');
|
13968
|
+
counter += 1;
|
13969
|
+
},
|
13970
|
+
|
13971
|
+
end_write: function() {
|
13972
|
+
counter -= 1;
|
13973
|
+
run_callbacks('end_write');
|
13974
|
+
},
|
13975
|
+
|
13976
|
+
// For test purpose only.
|
13977
|
+
reset_callbacks: function() {
|
13978
|
+
callbacks = {};
|
13979
|
+
current_token = 0;
|
13980
|
+
},
|
13981
|
+
|
13982
|
+
// For test purpose only.
|
13983
|
+
reset_counter: function() {
|
13984
|
+
counter = 0;
|
13985
|
+
}
|
13822
13986
|
}
|
13823
13987
|
});
|
13824
13988
|
}());
|
@@ -13874,17 +14038,11 @@ var infopark = {
|
|
13874
14038
|
});
|
13875
14039
|
}());
|
13876
14040
|
(function() {
|
13877
|
-
$(document).on("click.ip-deactivate-editing", "#ip_deactivate_editing", function(e) {
|
13878
|
-
e.preventDefault();
|
13879
|
-
infopark.editing.deactivate();
|
13880
|
-
});
|
13881
|
-
|
13882
14041
|
$.extend(infopark, {
|
13883
|
-
|
14042
|
+
menu_bar_saving_indicator: {
|
13884
14043
|
init: function() {
|
13885
14044
|
infopark.menu_bar.register_item_renderer(function(parent_view) {
|
13886
|
-
|
13887
|
-
parent_view.find('#ip_deactivate_editing').append(view);
|
14045
|
+
infopark.saving_indicator.create(parent_view.find('#ip_menu_bar_saving_indicator'));
|
13888
14046
|
});
|
13889
14047
|
}
|
13890
14048
|
}
|
@@ -13892,22 +14050,47 @@ var infopark = {
|
|
13892
14050
|
}());
|
13893
14051
|
(function() {
|
13894
14052
|
$.extend(infopark, {
|
13895
|
-
|
14053
|
+
menu_bar_dropdown: {
|
13896
14054
|
init: function() {
|
13897
|
-
infopark.menu_bar.register_item_renderer(function(
|
13898
|
-
|
13899
|
-
|
13900
|
-
|
13901
|
-
}
|
14055
|
+
infopark.menu_bar.register_item_renderer(function(menu_bar) {
|
14056
|
+
var view = infopark.template.render('menu_bar_dropdown', {
|
14057
|
+
has_current_page: infopark.obj.current_page_id,
|
14058
|
+
current_page_has_edit_view: infopark.obj.current_page_has_edit_view
|
14059
|
+
});
|
14060
|
+
menu_bar.find('#ip_menu_bar_dropdown').append(view);
|
13902
14061
|
});
|
13903
14062
|
}
|
13904
14063
|
}
|
13905
14064
|
});
|
13906
14065
|
|
13907
|
-
|
13908
|
-
|
14066
|
+
var on_click = function(element_id, callback) {
|
14067
|
+
$(document).on('click.' + element_id, '#' + element_id, function(event) {
|
14068
|
+
event.preventDefault();
|
14069
|
+
callback();
|
14070
|
+
});
|
14071
|
+
};
|
14072
|
+
|
14073
|
+
on_click('ip_menu_bar_dropdown', function() {
|
14074
|
+
var target = $('#ip_menu_bar_dropdown');
|
14075
|
+
target.toggleClass('active');
|
14076
|
+
target.find('.ip_menu_box').fadeToggle('50');
|
14077
|
+
});
|
14078
|
+
|
14079
|
+
on_click('ip_edit_current_page', function() {
|
14080
|
+
infopark.commands.edit_obj(infopark.obj.current_page());
|
14081
|
+
});
|
14082
|
+
|
14083
|
+
on_click('ip_delete_current_page', function() {
|
13909
14084
|
infopark.commands.delete_obj(infopark.obj.current_page());
|
13910
14085
|
});
|
14086
|
+
|
14087
|
+
on_click('ip_open_current_page_in_admin_gui', function() {
|
14088
|
+
infopark.commands.open_in_admin_gui(infopark.obj.current_page_id);
|
14089
|
+
});
|
14090
|
+
|
14091
|
+
on_click('ip_deactivate_editing', function() {
|
14092
|
+
infopark.editing.deactivate();
|
14093
|
+
});
|
13911
14094
|
}());
|
13912
14095
|
(function() {
|
13913
14096
|
var t = infopark.i18n.translate;
|
@@ -14070,7 +14253,10 @@ var infopark = {
|
|
14070
14253
|
blob: {
|
14071
14254
|
create: function(file) {
|
14072
14255
|
return get_upload_permission().then(function(permission) {
|
14073
|
-
|
14256
|
+
infopark.write_monitor.start_write();
|
14257
|
+
return upload_to_s3(file, permission).always(function() {
|
14258
|
+
infopark.write_monitor.end_write();
|
14259
|
+
});
|
14074
14260
|
});
|
14075
14261
|
},
|
14076
14262
|
|
@@ -14113,7 +14299,8 @@ var infopark = {
|
|
14113
14299
|
},
|
14114
14300
|
|
14115
14301
|
fetch_page_class_selection: function() {
|
14116
|
-
return infopark.ajax('GET', 'objs/page_class_selection'
|
14302
|
+
return infopark.ajax('GET', 'objs/page_class_selection?' +
|
14303
|
+
$.param({parent_path: that.path()}));
|
14117
14304
|
},
|
14118
14305
|
|
14119
14306
|
create_child: function(obj_class) {
|
@@ -14174,6 +14361,10 @@ $(function() {
|
|
14174
14361
|
});
|
14175
14362
|
}());
|
14176
14363
|
(function() {
|
14364
|
+
var has_original_content = function(field_type) {
|
14365
|
+
return _.contains(['string', 'text', 'html', 'enum', 'multienum'], field_type);
|
14366
|
+
};
|
14367
|
+
|
14177
14368
|
$.extend(infopark, {
|
14178
14369
|
cms_field_element: {
|
14179
14370
|
create_instance: function(cms_element) {
|
@@ -14205,6 +14396,20 @@ $(function() {
|
|
14205
14396
|
var changes = {};
|
14206
14397
|
changes[that.field_name()] = content;
|
14207
14398
|
return that.obj().save(changes);
|
14399
|
+
},
|
14400
|
+
|
14401
|
+
original_content: function() {
|
14402
|
+
if (has_original_content(that.field_type())) {
|
14403
|
+
return JSON.parse(that.dom_element().attr('data-ip-field-original-content'));
|
14404
|
+
} else {
|
14405
|
+
$.error('Fields of type ' + that.field_type() + ' do not support original content');
|
14406
|
+
}
|
14407
|
+
},
|
14408
|
+
|
14409
|
+
set_original_content: function(content) {
|
14410
|
+
if (has_original_content(that.field_type())) {
|
14411
|
+
that.dom_element().attr('data-ip-field-original-content', JSON.stringify(content));
|
14412
|
+
}
|
14208
14413
|
}
|
14209
14414
|
|
14210
14415
|
});
|
@@ -14219,10 +14424,7 @@ $(function() {
|
|
14219
14424
|
date_field_element: {
|
14220
14425
|
create_instance: function(cms_element) {
|
14221
14426
|
if (cms_element.dom_element().attr('data-ip-field-type') === 'date') {
|
14222
|
-
|
14223
|
-
return $.extend({}, cms_field_element, {save: function(content) {
|
14224
|
-
return cms_field_element.save(content instanceof Date ? format_date(content) : content);
|
14225
|
-
}});
|
14427
|
+
return infopark.cms_field_element.create_instance(cms_element);
|
14226
14428
|
}
|
14227
14429
|
},
|
14228
14430
|
|
@@ -14234,20 +14436,6 @@ $(function() {
|
|
14234
14436
|
}
|
14235
14437
|
});
|
14236
14438
|
|
14237
|
-
var format_date = function(date) {
|
14238
|
-
return date.getUTCFullYear().toString() +
|
14239
|
-
format_number(date.getUTCMonth() + 1) + // Month numbers are starting at 0.
|
14240
|
-
format_number(date.getUTCDate()) +
|
14241
|
-
format_number(date.getUTCHours()) +
|
14242
|
-
format_number(date.getUTCMinutes()) +
|
14243
|
-
format_number(date.getUTCSeconds());
|
14244
|
-
};
|
14245
|
-
|
14246
|
-
var format_number = function(number) {
|
14247
|
-
var string = number.toString();
|
14248
|
-
return string.length === 1 ? '0' + string : string;
|
14249
|
-
};
|
14250
|
-
|
14251
14439
|
infopark.cms_element.definitions.push(infopark.date_field_element);
|
14252
14440
|
}());
|
14253
14441
|
(function() {
|
@@ -14316,6 +14504,39 @@ $(function() {
|
|
14316
14504
|
infopark.cms_element.definitions.push(infopark.multienum_field_element);
|
14317
14505
|
}());
|
14318
14506
|
(function() {
|
14507
|
+
var format_date = function(date) {
|
14508
|
+
return date.getUTCFullYear().toString() +
|
14509
|
+
format_date_number(date.getUTCMonth() + 1) + // Month numbers are starting at 0.
|
14510
|
+
format_date_number(date.getUTCDate()) +
|
14511
|
+
format_date_number(date.getUTCHours()) +
|
14512
|
+
format_date_number(date.getUTCMinutes()) +
|
14513
|
+
format_date_number(date.getUTCSeconds());
|
14514
|
+
};
|
14515
|
+
|
14516
|
+
var format_date_number = function(number) {
|
14517
|
+
var string = number.toString();
|
14518
|
+
return string.length === 1 ? '0' + string : string;
|
14519
|
+
};
|
14520
|
+
|
14521
|
+
var prepare_attributes = function(data) {
|
14522
|
+
var attributes = {};
|
14523
|
+
_.each(data, function(value, field_name) {
|
14524
|
+
if (value instanceof Date) {
|
14525
|
+
value = format_date(value);
|
14526
|
+
}
|
14527
|
+
attributes[field_name] = value;
|
14528
|
+
});
|
14529
|
+
|
14530
|
+
if (attributes.blob) {
|
14531
|
+
return infopark.blob.create(attributes.blob).then(function(blob_id) {
|
14532
|
+
attributes.blob = blob_id;
|
14533
|
+
return attributes;
|
14534
|
+
});
|
14535
|
+
} else {
|
14536
|
+
return $.Deferred().resolve(attributes);
|
14537
|
+
}
|
14538
|
+
};
|
14539
|
+
|
14319
14540
|
$.extend(infopark, {
|
14320
14541
|
obj: {
|
14321
14542
|
create_instance: function(id, obj_class_name) {
|
@@ -14329,13 +14550,21 @@ $(function() {
|
|
14329
14550
|
},
|
14330
14551
|
|
14331
14552
|
save: function(data) {
|
14332
|
-
return
|
14333
|
-
|
14334
|
-
|
14553
|
+
return prepare_attributes(data).then(function(attributes) {
|
14554
|
+
return infopark.ajax('PUT', 'objs/' + that.id(), {data: {obj: attributes}}).then(
|
14555
|
+
function(result) { return; }
|
14556
|
+
);
|
14557
|
+
});
|
14335
14558
|
},
|
14336
14559
|
|
14337
14560
|
destroy: function() {
|
14338
14561
|
return infopark.ajax('DELETE', 'objs/' + that.id());
|
14562
|
+
},
|
14563
|
+
|
14564
|
+
fetch_edit_markup: function() {
|
14565
|
+
return infopark.ajax('GET', 'objs/' + that.id() + '/edit').then(function(data) {
|
14566
|
+
return data.markup;
|
14567
|
+
});
|
14339
14568
|
}
|
14340
14569
|
};
|
14341
14570
|
|
@@ -14343,11 +14572,11 @@ $(function() {
|
|
14343
14572
|
},
|
14344
14573
|
|
14345
14574
|
create: function(data) {
|
14346
|
-
return
|
14347
|
-
function(new_data) {
|
14575
|
+
return prepare_attributes(data).then(function(attributes) {
|
14576
|
+
return infopark.ajax('POST', 'objs', {data: {obj: attributes}}).then(function(new_data) {
|
14348
14577
|
return infopark.obj.create_instance(new_data.id, new_data._obj_class);
|
14349
|
-
}
|
14350
|
-
);
|
14578
|
+
});
|
14579
|
+
});
|
14351
14580
|
},
|
14352
14581
|
|
14353
14582
|
current_page_id: null,
|
@@ -14356,7 +14585,9 @@ $(function() {
|
|
14356
14585
|
if (infopark.obj.current_page_id) {
|
14357
14586
|
return infopark.obj.create_instance(infopark.obj.current_page_id);
|
14358
14587
|
}
|
14359
|
-
}
|
14588
|
+
},
|
14589
|
+
|
14590
|
+
current_page_has_edit_view: false
|
14360
14591
|
}
|
14361
14592
|
});
|
14362
14593
|
}());
|
@@ -14410,7 +14641,7 @@ $(function() {
|
|
14410
14641
|
},
|
14411
14642
|
|
14412
14643
|
fetch_edit_markup: function() {
|
14413
|
-
return infopark.ajax('GET', 'objs/' + that.obj().id() + '/
|
14644
|
+
return infopark.ajax('GET', 'objs/' + that.obj().id() + '/edit_widget').then(function(data) {
|
14414
14645
|
return data.markup;
|
14415
14646
|
});
|
14416
14647
|
},
|
@@ -14474,7 +14705,8 @@ $(function() {
|
|
14474
14705
|
},
|
14475
14706
|
|
14476
14707
|
fetch_widget_class_selection: function() {
|
14477
|
-
return infopark.ajax('GET', 'objs/
|
14708
|
+
return infopark.ajax('GET', 'objs/' + that.obj().id() + '/widget_class_selection?' +
|
14709
|
+
$.param({field_name: that.field_name()}));
|
14478
14710
|
}
|
14479
14711
|
});
|
14480
14712
|
|
@@ -14568,7 +14800,8 @@ $(function() {
|
|
14568
14800
|
transition: function(target, trigger_fn) {
|
14569
14801
|
var deferred = $.Deferred();
|
14570
14802
|
if (!infopark.transition.immediate_mode) {
|
14571
|
-
target.on('transitionend',
|
14803
|
+
target.on('webkitTransitionEnd oTransitionEnd otransitionend transitionend msTransitionEnd',
|
14804
|
+
function() { deferred.resolve(); });
|
14572
14805
|
setTimeout(trigger_fn, 0);
|
14573
14806
|
} else {
|
14574
14807
|
trigger_fn();
|
@@ -14590,41 +14823,28 @@ $(function() {
|
|
14590
14823
|
}
|
14591
14824
|
|
14592
14825
|
var dom_element = editor.$element;
|
14593
|
-
var item = infopark.cms_element.from_dom_element(dom_element);
|
14594
14826
|
|
14595
|
-
|
14596
|
-
dom_element.attr('data-ip-field-original-content', item.content());
|
14827
|
+
dom_element.infopark('save', $.trim(dom_element.html())).done(function() {
|
14597
14828
|
editor.destroy();
|
14598
|
-
}).fail(function(
|
14829
|
+
}).fail(function() {
|
14599
14830
|
editor.getBox().removeClass('ip_field_saving');
|
14600
|
-
infopark.alert(error_message);
|
14601
14831
|
});
|
14602
14832
|
};
|
14603
14833
|
|
14604
14834
|
var cancel_action = function(button_name, button_dom, button_object) {
|
14605
14835
|
// restore old content
|
14606
|
-
|
14607
|
-
this.set(item.attr('data-ip-field-original-content'));
|
14608
|
-
item.removeData('ip-field-original-content');
|
14609
|
-
|
14836
|
+
this.set(this.$element.infopark('content') || '');
|
14610
14837
|
this.destroy();
|
14611
14838
|
};
|
14612
14839
|
|
14613
14840
|
var redactor_options_for_type = function(type) {
|
14614
14841
|
var default_options = {
|
14615
|
-
lang: infopark.i18n.locale(),
|
14616
14842
|
focus: true,
|
14617
14843
|
convertDivs: false,
|
14618
14844
|
linebreaks: true,
|
14619
14845
|
buttonsCustom: {
|
14620
|
-
saveButton: {
|
14621
|
-
|
14622
|
-
callback: save_action
|
14623
|
-
},
|
14624
|
-
cancelButton: {
|
14625
|
-
title: infopark.i18n.translate('cancel'),
|
14626
|
-
callback: cancel_action
|
14627
|
-
}
|
14846
|
+
saveButton: {title: 'Save', callback: save_action},
|
14847
|
+
cancelButton: {title: 'Cancel', callback: cancel_action}
|
14628
14848
|
}
|
14629
14849
|
};
|
14630
14850
|
var special_options = {};
|
@@ -14658,47 +14878,40 @@ $(function() {
|
|
14658
14878
|
return $.extend(default_options, special_options);
|
14659
14879
|
};
|
14660
14880
|
|
14661
|
-
var cms_fields = function() {
|
14662
|
-
return
|
14663
|
-
infopark.string_field_element.all(),
|
14664
|
-
infopark.html_field_element.all()
|
14665
|
-
);
|
14881
|
+
var cms_fields = function(content, field_type) {
|
14882
|
+
return content.find('[data-ip-field-type="' + field_type + '"]');
|
14666
14883
|
};
|
14667
14884
|
|
14668
|
-
var add_onclick_redactor_handlers = function() {
|
14669
|
-
|
14670
|
-
_.each(cms_fields(), function(cms_field) {
|
14671
|
-
var
|
14672
|
-
var
|
14885
|
+
var add_onclick_redactor_handlers = function(content) {
|
14886
|
+
_.each(['string', 'html'], function(field_type) {
|
14887
|
+
_.each(cms_fields(content, field_type), function(cms_field) {
|
14888
|
+
var dom_element = $(cms_field);
|
14889
|
+
var redactor_options = redactor_options_for_type(field_type);
|
14673
14890
|
if (redactor_options !== null) {
|
14674
|
-
if(!
|
14675
|
-
|
14676
|
-
|
14677
|
-
$(dom_item).on('click.ip-editing', function(e) {
|
14891
|
+
if(!dom_element.hasClass('ip_field_editable')) {
|
14892
|
+
dom_element.addClass('ip_field_editable');
|
14893
|
+
dom_element.on('click', function(e) {
|
14678
14894
|
e.preventDefault();
|
14679
|
-
|
14680
|
-
|
14681
|
-
|
14682
|
-
if($(dom_item).data('redactor') === undefined) {
|
14683
|
-
$(dom_item).html($(dom_item).attr('data-ip-field-original-content'));
|
14684
|
-
$(dom_item).redactor(redactor_options);
|
14895
|
+
if(dom_element.data('redactor') === undefined) {
|
14896
|
+
dom_element.html(dom_element.infopark('content') || '');
|
14897
|
+
dom_element.redactor(redactor_options);
|
14685
14898
|
}
|
14686
14899
|
});
|
14687
14900
|
}
|
14688
14901
|
}
|
14689
14902
|
});
|
14690
|
-
}
|
14903
|
+
});
|
14691
14904
|
};
|
14692
14905
|
|
14693
14906
|
$.extend(infopark, {
|
14694
14907
|
redactor: {
|
14695
14908
|
init: function() {
|
14696
|
-
infopark.
|
14697
|
-
add_onclick_redactor_handlers();
|
14909
|
+
infopark.on('editing', function() {
|
14910
|
+
add_onclick_redactor_handlers($('body'));
|
14698
14911
|
});
|
14699
14912
|
|
14700
|
-
infopark.
|
14701
|
-
add_onclick_redactor_handlers();
|
14913
|
+
infopark.on('new_content', function(dom_element) {
|
14914
|
+
add_onclick_redactor_handlers($(dom_element));
|
14702
14915
|
});
|
14703
14916
|
}
|
14704
14917
|
}
|
@@ -14904,6 +15117,43 @@ $(function() {
|
|
14904
15117
|
|
14905
15118
|
return infopark;
|
14906
15119
|
}());
|
15120
|
+
(function() {
|
15121
|
+
$.extend(infopark, {
|
15122
|
+
saving_indicator: {
|
15123
|
+
create: function(parent_view) {
|
15124
|
+
var target_selector = '.ip_saving_indicator';
|
15125
|
+
var saving_in_progress_selector = target_selector + ' .ip_saving_in_progress';
|
15126
|
+
var saving_done_selector = target_selector + ' .ip_saving_done';
|
15127
|
+
|
15128
|
+
parent_view.append(infopark.template.render('saving_indicator'));
|
15129
|
+
|
15130
|
+
var start_write_token = infopark.write_monitor.on('start_write', function() {
|
15131
|
+
parent_view.find(saving_in_progress_selector).show();
|
15132
|
+
parent_view.find(saving_done_selector).hide();
|
15133
|
+
});
|
15134
|
+
|
15135
|
+
var end_write_token = infopark.write_monitor.on('end_write', function() {
|
15136
|
+
if (!infopark.write_monitor.is_writing()) {
|
15137
|
+
parent_view.find(saving_in_progress_selector).hide();
|
15138
|
+
parent_view.find(saving_done_selector).show();
|
15139
|
+
}
|
15140
|
+
});
|
15141
|
+
|
15142
|
+
return {
|
15143
|
+
destroy: function() {
|
15144
|
+
infopark.write_monitor.off(start_write_token);
|
15145
|
+
infopark.write_monitor.off(end_write_token);
|
15146
|
+
parent_view.find(target_selector).remove();
|
15147
|
+
},
|
15148
|
+
|
15149
|
+
// Test purpose only.
|
15150
|
+
start_write_token: start_write_token,
|
15151
|
+
end_write_token: end_write_token
|
15152
|
+
};
|
15153
|
+
}
|
15154
|
+
}
|
15155
|
+
});
|
15156
|
+
}());
|
14907
15157
|
(function() {
|
14908
15158
|
$.extend(infopark, {
|
14909
15159
|
with_element_overlay: function(dom_element, promise) {
|
@@ -15106,13 +15356,8 @@ $(function() {
|
|
15106
15356
|
}));
|
15107
15357
|
|
15108
15358
|
obj_classes_deferred.done(function(obj_class_selection) {
|
15109
|
-
var
|
15110
|
-
|
15111
|
-
});
|
15112
|
-
|
15113
|
-
var selection_view = infopark.template.render('choose_obj_class_list', {
|
15114
|
-
obj_classes: obj_classes
|
15115
|
-
});
|
15359
|
+
var selection_view = infopark.template.render('choose_obj_class_list',
|
15360
|
+
{obj_classes: obj_class_selection});
|
15116
15361
|
|
15117
15362
|
selection_view = $($.trim(selection_view));
|
15118
15363
|
|
@@ -15148,15 +15393,20 @@ $(function() {
|
|
15148
15393
|
(function() {
|
15149
15394
|
$.extend(infopark, {
|
15150
15395
|
edit_dialog: {
|
15151
|
-
open: function(title, markup) {
|
15396
|
+
open: function(title, markup, icon) {
|
15152
15397
|
var deferred = $.Deferred();
|
15153
15398
|
|
15154
|
-
var view = $(infopark.template.render('edit_dialog',
|
15399
|
+
var view = $(infopark.template.render('edit_dialog',
|
15400
|
+
{icon: icon || '', title: title, markup: markup}));
|
15155
15401
|
|
15156
15402
|
$('#ip-editing').append(view);
|
15157
15403
|
|
15404
|
+
var saving_indicator = infopark.saving_indicator.create(
|
15405
|
+
view.find('.ip_edit_dialog_saving_indicator'));
|
15406
|
+
|
15158
15407
|
var cancel_action = function(e) {
|
15159
15408
|
e.preventDefault();
|
15409
|
+
saving_indicator.destroy();
|
15160
15410
|
infopark.dialog.close(view);
|
15161
15411
|
deferred.resolve();
|
15162
15412
|
};
|
@@ -15165,12 +15415,11 @@ $(function() {
|
|
15165
15415
|
|
15166
15416
|
infopark.transition(view, function() {
|
15167
15417
|
view.addClass('ip_show');
|
15418
|
+
}).then(function() {
|
15419
|
+
infopark.dialog.adjust(view);
|
15420
|
+
infopark.editing.refresh(view.find('.ip_edit_dialog_markup').get(0));
|
15168
15421
|
});
|
15169
15422
|
|
15170
|
-
infopark.dialog.adjust(view);
|
15171
|
-
|
15172
|
-
infopark.editing.refresh(markup);
|
15173
|
-
|
15174
15423
|
return infopark.with_dialog_behaviour(deferred, {escape: cancel_action});
|
15175
15424
|
}
|
15176
15425
|
}
|
@@ -15329,6 +15578,22 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15329
15578
|
);
|
15330
15579
|
},
|
15331
15580
|
|
15581
|
+
edit_obj: function(obj) {
|
15582
|
+
return obj.fetch_edit_markup().then(function(markup) {
|
15583
|
+
var has_changes = false;
|
15584
|
+
var token = infopark.write_monitor.on('start_write', function() {
|
15585
|
+
has_changes = true;
|
15586
|
+
});
|
15587
|
+
var title = infopark.i18n.translate('current_page');
|
15588
|
+
return infopark.edit_dialog.open(title, markup, '').then(function() {
|
15589
|
+
infopark.write_monitor.off(token);
|
15590
|
+
if (has_changes) {
|
15591
|
+
return infopark.with_saving_overlay(infopark.reload());
|
15592
|
+
}
|
15593
|
+
});
|
15594
|
+
});
|
15595
|
+
},
|
15596
|
+
|
15332
15597
|
delete_obj: function(obj) {
|
15333
15598
|
return infopark.confirmation_dialog({
|
15334
15599
|
icon: '',
|
@@ -15347,20 +15612,21 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15347
15612
|
return infopark.choose_obj_class_dialog(
|
15348
15613
|
widget_field_element.fetch_widget_class_selection(), 'add_widget').then(
|
15349
15614
|
function(obj_class) {
|
15350
|
-
var
|
15615
|
+
var dom_element;
|
15351
15616
|
infopark.with_saving_overlay(
|
15352
15617
|
widget_field_element.create_widget(obj_class).then(function(data) {
|
15353
|
-
|
15618
|
+
dom_element = $(data.markup);
|
15354
15619
|
if (widget_element) {
|
15355
|
-
widget_element.dom_element().after(
|
15620
|
+
widget_element.dom_element().after(dom_element);
|
15356
15621
|
} else {
|
15357
|
-
widget_field_element.dom_element().append(
|
15622
|
+
widget_field_element.dom_element().append(dom_element);
|
15358
15623
|
}
|
15359
|
-
infopark.editing.refresh(
|
15360
|
-
return widget_field_element.save();
|
15624
|
+
infopark.editing.refresh(dom_element.get(0));
|
15361
15625
|
})
|
15362
15626
|
).then(function() {
|
15363
|
-
|
15627
|
+
return widget_field_element.save().then(function() {
|
15628
|
+
infopark.ensure_fully_visible_within(dom_element, $('body'), $(window).height());
|
15629
|
+
});
|
15364
15630
|
});
|
15365
15631
|
}
|
15366
15632
|
);
|
@@ -15370,13 +15636,21 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15370
15636
|
var obj = widget_element.obj();
|
15371
15637
|
var dom_element = widget_element.dom_element();
|
15372
15638
|
return widget_element.fetch_edit_markup().then(function(edit_markup) {
|
15639
|
+
var has_changes = false;
|
15640
|
+
var token = infopark.write_monitor.on('start_write', function() {
|
15641
|
+
has_changes = true;
|
15642
|
+
});
|
15373
15643
|
return infopark.edit_dialog.open(obj.obj_class_name(), edit_markup).then(function() {
|
15374
|
-
|
15375
|
-
|
15376
|
-
|
15377
|
-
|
15378
|
-
|
15379
|
-
|
15644
|
+
infopark.write_monitor.off(token);
|
15645
|
+
if (has_changes) {
|
15646
|
+
return infopark.with_element_overlay(dom_element,
|
15647
|
+
widget_element.fetch_show_markup().then(function(show_markup) {
|
15648
|
+
var new_dom_element = $(show_markup);
|
15649
|
+
dom_element.replaceWith(new_dom_element);
|
15650
|
+
infopark.editing.refresh(new_dom_element.get(0));
|
15651
|
+
})
|
15652
|
+
);
|
15653
|
+
}
|
15380
15654
|
});
|
15381
15655
|
});
|
15382
15656
|
},
|
@@ -15389,14 +15663,11 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15389
15663
|
title: infopark.i18n.translate('commands.delete_widget.confirm_title'),
|
15390
15664
|
description: infopark.i18n.translate('commands.delete_widget.confirm_description')
|
15391
15665
|
}).then(function() {
|
15392
|
-
|
15393
|
-
|
15394
|
-
|
15395
|
-
return
|
15396
|
-
|
15397
|
-
});
|
15398
|
-
};
|
15399
|
-
infopark.with_saving_overlay(delete_widget());
|
15666
|
+
widget_element.dom_element().remove();
|
15667
|
+
infopark.editing.refresh();
|
15668
|
+
return widget_field_element.save().then(function() {
|
15669
|
+
return widget_element.obj().destroy();
|
15670
|
+
});
|
15400
15671
|
});
|
15401
15672
|
},
|
15402
15673
|
|
@@ -15497,7 +15768,7 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15497
15768
|
update: function(event, ui) {
|
15498
15769
|
infopark.editing.refresh();
|
15499
15770
|
var widget_field_element = infopark.cms_element.from_dom_element(ui.item).widget_field();
|
15500
|
-
|
15771
|
+
widget_field_element.save();
|
15501
15772
|
}
|
15502
15773
|
}
|
15503
15774
|
});
|
@@ -15576,7 +15847,6 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15576
15847
|
image_upload: {
|
15577
15848
|
init: function() {
|
15578
15849
|
infopark.editing.on('activate', activate);
|
15579
|
-
infopark.editing.on('refresh', activate);
|
15580
15850
|
|
15581
15851
|
// Disable DnD for all elements by default to prevent the user
|
15582
15852
|
// from accidentally opening an image in browser.
|
@@ -15601,27 +15871,23 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15601
15871
|
var obj_id = dom_element.attr('data-ip-resource-source-obj-id');
|
15602
15872
|
var field_name = dom_element.attr('data-ip-resource-source-field-name');
|
15603
15873
|
|
15604
|
-
var
|
15874
|
+
var create_image = function(file) {
|
15605
15875
|
var obj_name = file.name.replace(/[^a-z0-9_.$\-]/ig, '-');
|
15606
15876
|
var path = '_resources/' + infopark.random_hex() + '/' + obj_name;
|
15607
|
-
return infopark.obj.create({
|
15877
|
+
return infopark.obj.create({blob: file, _path: path, _obj_class: 'Image'});
|
15608
15878
|
};
|
15609
15879
|
|
15610
|
-
var
|
15880
|
+
var link_image = function(resource_id) {
|
15611
15881
|
var attributes = {};
|
15612
15882
|
attributes[field_name] = [{obj_id: resource_id}];
|
15613
15883
|
return infopark.obj.create_instance(obj_id).save(attributes);
|
15614
15884
|
};
|
15615
15885
|
|
15616
|
-
infopark.with_saving_overlay(
|
15617
|
-
|
15618
|
-
return
|
15619
|
-
|
15620
|
-
|
15621
|
-
});
|
15622
|
-
});
|
15623
|
-
})
|
15624
|
-
);
|
15886
|
+
infopark.with_saving_overlay(create_image(file).then(function(data) {
|
15887
|
+
return link_image(data.id()).then(function() {
|
15888
|
+
return infopark.reload();
|
15889
|
+
});
|
15890
|
+
}));
|
15625
15891
|
}
|
15626
15892
|
|
15627
15893
|
}
|
@@ -15730,6 +15996,18 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15730
15996
|
}
|
15731
15997
|
});
|
15732
15998
|
}());
|
15999
|
+
(function() {
|
16000
|
+
$.extend(infopark, {
|
16001
|
+
warn_before_unloading: function() {
|
16002
|
+
if (infopark.write_monitor.is_writing()) {
|
16003
|
+
return infopark.i18n.translate('warn_before_unloading');
|
16004
|
+
}
|
16005
|
+
}
|
16006
|
+
});
|
16007
|
+
}());
|
16008
|
+
|
16009
|
+
|
16010
|
+
|
15733
16011
|
|
15734
16012
|
|
15735
16013
|
|
@@ -15780,8 +16058,8 @@ $(window).on('load', function () { infopark.inplace_menus.refresh_positions(); }
|
|
15780
16058
|
|
15781
16059
|
infopark.redactor.init();
|
15782
16060
|
infopark.inplace_menus.init();
|
15783
|
-
infopark.
|
15784
|
-
infopark.
|
16061
|
+
infopark.menu_bar_saving_indicator.init();
|
16062
|
+
infopark.menu_bar_dropdown.init();
|
15785
16063
|
infopark.workspace_select.init();
|
15786
16064
|
infopark.menu_bar.init();
|
15787
16065
|
infopark.widget_menus.init();
|
@@ -15789,3 +16067,5 @@ infopark.widget_sorting.init();
|
|
15789
16067
|
infopark.image_upload.init();
|
15790
16068
|
infopark.child_list_menus.init();
|
15791
16069
|
infopark.editable_workspace_dialog.init();
|
16070
|
+
|
16071
|
+
window.onbeforeunload = infopark.warn_before_unloading;
|