<?xml version="1.0" encoding="UTF-8"?>
<javascript app="rules">
 <file javascript_app="rules" javascript_location="admin" javascript_path="controllers/ui" javascript_name="ips.ui.chosen.js" javascript_type="controller" javascript_version="100406" javascript_position="1000050"><![CDATA[/**
 * Rules Chosen Controller
 * 
 * Author: Kevin Carwile
 */

;( function($, _, undefined){
	"use strict";

	ips.controller.register( 'rules.admin.ui.chosen', 
	{
		initialize: function()
		{
			if ( typeof $.fn.chosen != 'undefined' )
			{
				var scope = this.scope;
				scope.find( 'select' )
				.chosen(
				{
					disable_search_threshold: 10,
					search_contains: true,
					include_group_label_in_selected: false
				})
				.on( 'change', function( e )
				{
					if ( $(this).attr( 'id' ).match(/_source$/) && $(this).val() == 'event' )
					{
						var eventArgSelect = $( '#' + $(this).attr( 'id' ).replace( '_source', '_eventArg' ) );
						eventArgSelect.change();
					}
				});
				
				scope.on( 'click', '.group-result', function()
				{
					var current = $(this).next();
					while( current.hasClass( 'group-option' ) )
					{
						if ( ! current.hasClass( 'result--selected' ) )
						{
							current.toggle();
						}
						current = current.next();
					}
				});
				
				/**
				 * Chosen interferes with the IPS process of hiding toggle fields
				 * for the select input, so we wait momentarily to fire the event
				 * again and trigger any toggles.
				 */
				setTimeout( function() 
				{
					var select = scope.find( 'select' );
					
					/**
					 * Make sure the change event is fired one last time after
					 * all others if this is the data source select box.
					 */
					if ( select.attr( 'id' ).match(/_source$/) )
					{
						setTimeout( function() 
						{
							select.change();
						}, 
						500 );
					}
					
					select.change();
				}, 
				200 );
							
			}
		}
		
	});
}(jQuery, _));]]></file>
 <file javascript_app="rules" javascript_location="admin" javascript_path="controllers/ui" javascript_name="ips.ui.tokens.js" javascript_type="controller" javascript_version="100406" javascript_position="1000050">/**
 * Rules Chosen Controller
 * 
 * Author: Kevin Carwile
 */

;( function($, _, undefined){
	&quot;use strict&quot;;

	ips.controller.register( 'rules.admin.ui.tokens', {
	
		initialize: function()
		{
			var scope = this.scope;
			
			scope.find( '.tokens-toggle' ).click( function() {
				scope.find( '.tokens-list' ).slideToggle();
				$(this).find( 'i' ).toggleClass( 'fa-caret-right fa-caret-down' );
			});
		}
		
	});
}(jQuery, _));</file>
 <file javascript_app="rules" javascript_location="front" javascript_path="controllers/ui" javascript_name="ips.ui.table.js" javascript_type="controller" javascript_version="100406" javascript_position="1000050">/**
 * Rules Table Controller
 * 
 * Author: Kevin Carwile
 */

;( function($, _, undefined){
	&quot;use strict&quot;;

	ips.controller.register( 'rules.front.ui.table', {
	
		initialize: function()
		{
			this.on( 'paginationClicked paginationJump', this.paginationClicked );
		},
		
		/**
		 * Responds to a pagination click
		 *	
		 * @param 		{event} 	e 		Event object
		 * @param 		{object} 	data 	Event data object
		 * @returns 	{void}
		 */
		paginationClicked: function (e, data) {
			e.stopPropagation();
		}
		
	});
}(jQuery, _));</file>
</javascript>
