src/pyams_content/skin/resources/js/pyams_content.js
changeset 460 c01cb2647695
parent 364 b2fc446f15d9
child 473 482e02c1f3d5
equal deleted inserted replaced
459:257b8c748005 460:c01cb2647695
   159 					var source = $(this);
   159 					var source = $(this);
   160 					var association = source.parents('tr');
   160 					var association = source.parents('tr');
   161 					var container = association.parents('table');
   161 					var container = association.parents('table');
   162 					MyAMS.ajax.post(container.data('ams-location') + '/set-association-visibility.json',
   162 					MyAMS.ajax.post(container.data('ams-location') + '/set-association-visibility.json',
   163 						{object_name: association.data('ams-element-name')},
   163 						{object_name: association.data('ams-element-name')},
       
   164 						function (result, status) {
       
   165 							if (result.visible) {
       
   166 								$('i', source).attr('class', 'fa fa-fw fa-eye');
       
   167 							} else {
       
   168 								$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
       
   169 							}
       
   170 						});
       
   171 				};
       
   172 			}
       
   173 		},
       
   174 
       
   175 		/**
       
   176 		 * Milestones paragraph management
       
   177 		 */
       
   178 		milestones: {
       
   179 
       
   180 			refreshMilestones: function(options) {
       
   181 				// Reload widget
       
   182 				var widget = MyAMS.skin.refreshTable(options);
       
   183 				// Check fieldset state
       
   184 				var legend = widget.siblings('legend');
       
   185 				if (legend.parents('fieldset:first').hasClass('switched')) {
       
   186 					legend.click();
       
   187 				}
       
   188 			},
       
   189 
       
   190 			switchVisibility: function (element) {
       
   191 				return function () {
       
   192 					var source = $(this);
       
   193 					var milestone = source.parents('tr');
       
   194 					var container = milestone.parents('table');
       
   195 					MyAMS.ajax.post(container.data('ams-location') + '/set-milestone-visibility.json',
       
   196 						{object_name: milestone.data('ams-element-name')},
   164 						function (result, status) {
   197 						function (result, status) {
   165 							if (result.visible) {
   198 							if (result.visible) {
   166 								$('i', source).attr('class', 'fa fa-fw fa-eye');
   199 								$('i', source).attr('class', 'fa fa-fw fa-eye');
   167 							} else {
   200 							} else {
   168 								$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
   201 								$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
   405 								 function() {
   438 								 function() {
   406 									image.canvasAreaDraw({imageUrl: image.data('ams-image-url')});
   439 									image.canvasAreaDraw({imageUrl: image.data('ams-image-url')});
   407 								 });
   440 								 });
   408 			},
   441 			},
   409 
   442 
   410 			initSummary: function() {
   443 			initPreview: function() {
   411 				var image = $(this);
   444 				var image = $(this);
   412 				MyAMS.ajax.check($.fn.mapster,
   445 				MyAMS.ajax.check($.fn.mapster,
   413 								 '/--static--/pyams_content/js/jquery-imagemapster-1.2.10' + MyAMS.devext + '.js',
   446 								 '/--static--/pyams_content/js/jquery-imagemapster-1.2.10' + MyAMS.devext + '.js',
   414 								 function() {
   447 								 function() {
   415 									image.mapster({
   448 									image.mapster({