src/pyams_skin/resources/js/myams.js
changeset 378 ff73c764fa7d
parent 375 b0172b87669f
child 380 86957fbcdcc5
equal deleted inserted replaced
377:b0f7b9c8cd16 378:ff73c764fa7d
     1 /*
     1 /*
     2  * MyAMS
     2  * MyAMS
     3  * « My Application Management Skin »
     3  * « My Application Management Skin »
     4  *
     4  *
     5  * $Tag$ (rev. 1)
     5  * $Tag: 0.1.17 $ (rev. 1)
     6  * A bootstrap based application/administration skin
     6  * A bootstrap based application/administration skin
     7  *
     7  *
     8  * Custom administration and application skin tools
     8  * Custom administration and application skin tools
     9  * Released under Zope Public License ZPL 1.1
     9  * Released under Zope Public License ZPL 1.1
    10  * ©2014-2016 Thierry Florac <tflorac@ulthar.net>
    10  * ©2014-2016 Thierry Florac <tflorac@ulthar.net>
  4990 						} else {
  4990 						} else {
  4991 							$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
  4991 							$('i', source).attr('class', 'fa fa-fw fa-eye-slash text-danger');
  4992 						}
  4992 						}
  4993 					});
  4993 					});
  4994 			}
  4994 			}
       
  4995 		},
       
  4996 
       
  4997 		/**
       
  4998 		 * Switch element attribute
       
  4999 		 */
       
  5000 		switchElementAttribute: function() {
       
  5001 			return function() {
       
  5002 				var source = $(this);
       
  5003 				var cell = source.parents('td').first();
       
  5004 				var attribute = cell.data('ams-switcher-attribute-name');
       
  5005 				var row = source.parents('tr').first();
       
  5006 				var table = row.parents('table');
       
  5007 				ams.ajax.post(table.data('ams-location') + '/' +
       
  5008 							  (cell.data('ams-attribute-switcher') || table.data('ams-attribute-switcher')),
       
  5009 					{object_name: row.data('ams-element-name')},
       
  5010 					function(result, status) {
       
  5011 						if (result.on) {
       
  5012 							$('i', source).attr('class', table.data('ams-' + attribute + '-icon-on') || 'fa fa-fw fa-eye');
       
  5013 						} else {
       
  5014 							$('i', source).attr('class', table.data('ams-' + attribute + '-icon-off') || 'fa fa-fw fa-eye-slash text-danger');
       
  5015 						}
       
  5016 					});
       
  5017 			}
  4995 		}
  5018 		}
  4996 	};
  5019 	};
  4997 
  5020 
  4998 
  5021 
  4999 	/**
  5022 	/**