2011-03-28 18:47:50 -07:00
|
|
|
$(function() {
|
2011-04-05 00:38:18 -07:00
|
|
|
|
|
|
|
|
// console.profile();
|
|
|
|
|
$(":input").hide();
|
|
|
|
|
$(".editButton").show();
|
|
|
|
|
|
|
|
|
|
/*$("tr").dblclick(function() {
|
|
|
|
|
|
|
|
|
|
makeEditable($(this).attr('id'));
|
|
|
|
|
});*/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".editButton").click(function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var id = $(this).parents('tr').attr('id');
|
|
|
|
|
//alert(id);
|
|
|
|
|
makeEditable(id);
|
|
|
|
|
|
|
|
|
|
$(this).hide();
|
|
|
|
|
|
|
|
|
|
$("#"+id).find('.viewText').hide();
|
|
|
|
|
$("#"+id).find('.saveButton').show();
|
|
|
|
|
$("#"+id).find('.cancelButton').show();
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".cancelButton").click(function() {
|
|
|
|
|
|
|
|
|
|
var id = $(this).parents('tr').attr('id');
|
|
|
|
|
$(this).hide();
|
|
|
|
|
$("#"+id).find('.saveButton').hide();
|
|
|
|
|
$("#"+id).find('.editButton').show();
|
|
|
|
|
cancelEditable(id);
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$(".saveButton").click(function() {
|
|
|
|
|
var id = $(this).parents('tr').attr('id');
|
|
|
|
|
var serializedForm = $("#"+'form_'+id).serialize();
|
|
|
|
|
|
|
|
|
|
$.post('/jobs/ajax_edit', serializedForm, function(data) {
|
|
|
|
|
alert("Posted the Form!!"+data); //Need to do something here to update the Row.
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//console.log($("#"+id).find('form').serialize());
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('form').submit(function() {
|
|
|
|
|
//console.log($(this).serialize());
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//console.profileEnd();
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function makeEditable(id) {
|
|
|
|
|
$("#"+id).find(':input').show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function cancelEditable(id) {
|
|
|
|
|
$("#"+id).find(':input').hide();
|
|
|
|
|
$(".editButton").show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function getParent() {
|
|
|
|
|
|
|
|
|
|
}
|