Sha256: 0bbd8aacc95ae137cac1d612a86eff8ce234f0a2a2368c5d0d917eb005c79020

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

jQuery(function(){
	
	var listing = jQuery('#context_list'),
		form    = listing.closest('form'),
		options = {
			title: 'Options',
			autoOpen: false,
			draggable: true,
			resizable: false,
			dialogClass: 'transit_context_dialog',
			minWidth: false,
			minHeight: false
		};
	
	listing
		.bind("context:added", add_new_context)
		.bind("context:destroyed", remove_context);
	
	listing.find('li.field').each( function(i, item ){
		var item = jQuery(item), panel;
		if( item.hasClass('field_text') ) return true;
		
		panel = item.find('div.toolbar') 
		panel.dialog( options );
		item.bind('mouseover', function( event ){
				item.addClass('ui-state-hover');
			})
			.bind('mouseout', function( event){
				item.removeClass('ui-state-hover');
			})
			.bind('click', function( event ){
				panel.dialog('open');
			});
		
	});
	
	function add_new_context( event, content, type ){
		var toolbar;
		if( (/text/i).test(type) ) return true;
		
		content = jQuery(content);
		toolbar = jQuery(content.filter('div.toolbar'));		
		toolbar.dialog( options );
		listing.append(content);
		
	}
	
	function remove_context( event, target ){
		
	}
		
});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
transit-0.0.2 app/assets/javascripts/transit/admin/contexts.js