comparison media/js/bio.js @ 138:7ea842744a57

Ticket #15, add a way to report user profiles.
author Brian Neal <bgneal@gmail.com>
date Fri, 27 Nov 2009 21:55:32 +0000
parents c515b7401078
children
comparison
equal deleted inserted replaced
137:c7d75cdfea21 138:7ea842744a57
1
2 $(document).ready(function() { 1 $(document).ready(function() {
3 $('#id_birthday').datepicker({changeMonth: true, 2 var bday = $('#id_birthday');
4 changeYear: true, 3 // jquery ui may not always be loaded
5 dateFormat: 'yy-mm-dd', 4 if (bday.length) {
6 defaultDate: '-30y', 5 bday.datepicker({changeMonth: true,
7 minDate: new Date(1909, 0, 1), 6 changeYear: true,
8 maxDate: new Date(), 7 dateFormat: 'yy-mm-dd',
9 yearRange: '-100:+0'}); 8 defaultDate: '-30y',
9 minDate: new Date(1909, 0, 1),
10 maxDate: new Date(),
11 yearRange: '-100:+0'});
12 }
13 $('a.profile-flag').click(function() {
14 var id = this.id;
15 if (id.match(/fp-(\d+)/)) {
16 id = RegExp.$1;
17 if (confirm('Only report a profile if you feel it is spam, abuse, ' +
18 'violates site rules, or is not appropriate. ' +
19 'A moderator will be notified and will review the profile. ' +
20 'Are you sure you want to report this profile?')) {
21 $.ajax({
22 url: '/profile/flag/' + id + '/',
23 type: 'POST',
24 dataType: 'text',
25 success: function (response, textStatus) {
26 alert(response);
27 },
28 error: function (xhr, textStatus, ex) {
29 alert('Oops, an error occurred: ' + xhr.statusText + ' - ' + xhr.responseText);
30 }
31 });
32 }
33 }
34 return false;
35 });
10 }); 36 });