src/pyams_content/skin/resources/js/pyams_content.js
changeset 460 c01cb2647695
parent 364 b2fc446f15d9
child 473 482e02c1f3d5
--- a/src/pyams_content/skin/resources/js/pyams_content.js	Sat Mar 10 02:36:40 2018 +0100
+++ b/src/pyams_content/skin/resources/js/pyams_content.js	Sat Mar 10 02:38:59 2018 +0100
@@ -173,6 +173,39 @@
 		},
 
 		/**
+		 * Milestones paragraph management
+		 */
+		milestones: {
+
+			refreshMilestones: function(options) {
+				// Reload widget
+				var widget = MyAMS.skin.refreshTable(options);
+				// Check fieldset state
+				var legend = widget.siblings('legend');
+				if (legend.parents('fieldset:first').hasClass('switched')) {
+					legend.click();
+				}
+			},
+
+			switchVisibility: function (element) {
+				return function () {
+					var source = $(this);
+					var milestone = source.parents('tr');
+					var container = milestone.parents('table');
+					MyAMS.ajax.post(container.data('ams-location') + '/set-milestone-visibility.json',
+						{object_name: milestone.data('ams-element-name')},
+						function (result, status) {
+							if (result.visible) {
+								$('i', source).attr('class', 'fa fa-fw fa-eye');
+							} else {
+								$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
+							}
+						});
+				};
+			}
+		},
+
+		/**
 		 * Paragraphs management
 		 */
 		paragraphs: {
@@ -407,7 +440,7 @@
 								 });
 			},
 
-			initSummary: function() {
+			initPreview: function() {
 				var image = $(this);
 				MyAMS.ajax.check($.fn.mapster,
 								 '/--static--/pyams_content/js/jquery-imagemapster-1.2.10' + MyAMS.devext + '.js',