Sha256: 08e9f9cb5319ead4f2d3ed4553a2aa1bfa9a461e5e4498cf924fb1455bcc1989

Contents?: true

Size: 1.63 KB

Versions: 2

Compression:

Stored size: 1.63 KB

Contents

function setUpSortables() {
	$('[data-sortable]').sortable({axis:'y', 
																  dropOnEmpty:false, 
																  update: function(event, ui) {
																		sortable = this;
																		$.ajax({data:$(this).sortable('serialize',{key:sortable.id + '[]'}),
																						complete: function(request) {$(sortable).effect('highlight')}, 
																						success:function(request){$('#errors').html(request)}, 
																						type:'POST', 
																						url: $(sortable).attr('data-sortable-url')
																					 })
																		}
	});
	$('[data-sortable][data-sortable-handle]').each(function() {
		handle = $(this).attr('data-sortable-handle');
		$(this).sortable("option", "handle", handle);
	});
	
		
	$('.droppable').droppable({
		activeClass: 'droppable-active',
		drop: function( event, ui ) {
			$.post($(this).attr('data-url'), {draggable_element: ui.draggable.attr('id')}, function() {}, 'script')
		}
	});
}

function setUpCalendars() {
	now = new Date();
	year = now.getFullYear() + 10;
	$('[data-calendar]').datepicker({changeYear:true,
																	 yearRange: '1950:' + year})
}

function setUpJsHelpers() {
		// ==================
		// Sortable
		setUpSortables();
		// ==================
		
		// ==================
		// Calendar
		setUpCalendars();
  	// ==================
		$(".tip[title], a[title]").tooltip()
}

function fixGridColumnWidths() {
	$("table.grid").each(function(i, grid) {
		num_columns = $(grid).find("th").length;
		if (num_columns > 0) {
			width = (100 / num_columns) + "%";
			$(grid).find("th").css("width", width);
			$(grid).find("td").css("width", width);
		}
	});
};

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fe-0.0.4 app/assets/javascripts/fe/fe.common.js
fe-0.0.3 app/assets/javascripts/fe/qe.common.js