src/pyams_thesaurus/zmi/resources/js/pyams_thesaurus.js
changeset 114 e7e4b4146a91
parent 102 882b5db98946
child 118 935341eda021
equal deleted inserted replaced
113:ab8863529acf 114:e7e4b4146a91
   182 			}
   182 			}
   183 		},
   183 		},
   184 
   184 
   185 
   185 
   186 		/**
   186 		/**
       
   187 		 * Thesaurus term tree widget
       
   188 		 */
       
   189 		widget: {
       
   190 
       
   191 			/**
       
   192 			 * Initialize terms lists by adding class to lists headers containing selected terms
       
   193 			 */
       
   194 			initTree: function(element) {
       
   195 				$('input:checked', element).parents('.widget-body:first')
       
   196 										   .siblings('header')
       
   197 										   .addClass('active');
       
   198 			},
       
   199 
       
   200 			/**
       
   201 			 * Update header status after term (de)selection
       
   202 			 */
       
   203 			updateSelection: function(event) {
       
   204 				var widget = $(this).parents('.widget-body:first');
       
   205 				var header = widget.siblings('header');
       
   206 				header.removeClass('active');
       
   207 				if ($('input:checked', widget).exists()) {
       
   208 					header.addClass('active');
       
   209 				}
       
   210 			}
       
   211 		},
       
   212 
       
   213 
       
   214 		/**
   187 		 * Search terms in tree
   215 		 * Search terms in tree
   188 		 */
   216 		 */
   189 		search: function() {
   217 		search: function() {
   190 			var label = $(this).val();
   218 			var label = $(this).val();
   191 			PyAMS_thesaurus.tree.findTerm({term: label});
   219 			PyAMS_thesaurus.tree.findTerm({term: label});