Files
Chad Whitacre 28cb48c72a Big changeover from id to username; #287
I sort of did this one with the blast shield down. I haven't even run
the tests yet. The sorts of things I changed:

 - SQL {elsewhere,exchanges}.participant_id => .participant
 - SQL participants.id => .username
 - ORM {user,participant,self}.id => .username
2013-04-05 15:48:59 -04:00

32 lines
1.0 KiB
JavaScript

$(document).ready(function()
{
// Wire up is_suspicious toggle.
// =============================
$('label.is-suspicious-knob').click(function()
{
var username = $(this).attr('data-username');
jQuery.ajax(
{ url: '/' + username + '/toggle-is-suspicious.json'
, type: 'POST'
, dataType: 'json'
, success: function(data)
{
if (data.is_suspicious)
$(".on-profile").addClass('is-suspicious');
else
$(".on-profile").removeClass('is-suspicious');
$('INPUT.is-suspicious-knob').attr( 'checked'
, data.is_suspicious
);
}
, error: function() {
alert( "Failed to change is_suspicious. Please "
+ "try again."
);
}
}
);
});
});