annotate media/js/bio.js @ 166:8acf5be27f18

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