src/pyams_content/skin/resources/js/pyams_content.js
changeset 176 64e00f5537fe
parent 171 13db231ca918
child 179 fb7c5f27e8a3
--- a/src/pyams_content/skin/resources/js/pyams_content.js	Wed Sep 20 12:11:23 2017 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.js	Wed Sep 20 12:12:58 2017 +0200
@@ -277,11 +277,11 @@
 		 */
 		associations: {
 
-			afterUpdateCallback: function(options) {
+			refreshAssociations: function(options) {
 				// Reload widget
-				var widget = $('#' + options.parent).parent('.ams-widget');
+				var widget = $('#' + options.object_name).parent('.ams-widget');
 				widget.replaceWith($(options.table));
-				widget = $('#' + options.parent).parent('.ams-widget');
+				widget = $('#' + options.object_name).parent('.ams-widget');
 				MyAMS.initContent(widget);
 				// Check fieldset state
 				var legend = widget.siblings('legend');
@@ -314,6 +314,12 @@
 		 */
 		fields: {
 
+			refreshField: function(changes) {
+				var container = $('table[id="form_fields_list"]');
+				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]', container);
+				$('td:nth-child(4)', para).html(changes.title);
+			},
+
 			switchVisibility: function (element) {
 				return function () {
 					var source = $(this);
@@ -329,12 +335,6 @@
 							}
 						});
 				};
-			},
-
-			refreshField: function(changes) {
-				var container = $('table[id="form_fields_list"]');
-				var para = $('tr[data-ams-element-name="' + changes.object_name + '"]', container);
-				$('td:nth-child(4)', para).html(changes.title);
 			}
 		},
 
@@ -344,10 +344,10 @@
 		 */
 		illustration: {
 
-			afterUpdateCallback: function(options) {
-				var parent = $('#' + options.parent);
+			refreshIllustration: function(options) {
+				var parent = $('#' + options.object_name);
 				parent.replaceWith($(options.form));
-				parent = $('#' + options.parent);
+				parent = $('#' + options.object_name);
 				MyAMS.initContent(parent);
 			}
 		},
@@ -483,6 +483,12 @@
 			case 'paragraph':
 				PyAMS_content.paragraphs.refreshParagraph(settings);
 				break;
+			case 'associations':
+				PyAMS_content.associations.refreshAssociations(settings);
+				break;
+			case 'illustration':
+				PyAMS_content.illustration.refreshIllustration(settings);
+				break;
 			case 'form_field':
 				PyAMS_content.fields.refreshField(settings);
 				break;