comparison gpp/shoutbox/static/js/shoutbox_app.js @ 312:88b2b9cb8c1f

Fixing #142; cut over to the django.contrib.staticfiles app.
author Brian Neal <bgneal@gmail.com>
date Thu, 27 Jan 2011 02:56:10 +0000
parents
children
comparison
equal deleted inserted replaced
311:b1c39788e511 312:88b2b9cb8c1f
1 $(document).ready(function() {
2 $('div.shoutbox-history table tr:odd').addClass('odd');
3 $('.edit').editable('/shout/edit/', {
4 loadurl : '/shout/text/',
5 indicator : 'Saving...',
6 tooltip : 'Click to edit your shout...',
7 submit : 'OK',
8 cancel : 'Cancel'
9 });
10 $('a.shout-del').click(function () {
11 if (confirm('Really delete this shout?')) {
12 var id = this.id;
13 if (id.match(/^shout-del-(\d+)/)) {
14 $.ajax({
15 url: '/shout/delete/',
16 type: 'POST',
17 data: { id : RegExp.$1 },
18 dataType: 'text',
19 success: function (id) {
20 var id = '#shout-del-' + id;
21 $(id).parents('tr').fadeOut(1500, function () {
22 $('div.shoutbox-history table tr:visible:even').removeClass('odd');
23 $('div.shoutbox-history table tr:visible:odd').addClass('odd');
24 });
25 },
26 error: function (xhr, textStatus, ex) {
27 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
28 xhr.responseText);
29 }
30 });
31 }
32 }
33 return false;
34 });
35 $('.shout-flag').click(function () {
36 var id = this.id;
37 if (id.match(/^shout-flag-(\d+)/)) {
38 id = RegExp.$1;
39 if (confirm('Only flag a shout if you feel it is spam, abuse, violates site rules, ' +
40 'or is not appropriate. ' +
41 'A moderator will be notified and will review the shout. ' +
42 'Are you sure you want to flag this shout?')) {
43 $.ajax({
44 url: '/shout/flag/',
45 type: 'POST',
46 data: { id : id },
47 dataType: 'text',
48 success: function(response) {
49 alert(response);
50 },
51 error: function (xhr, textStatus, ex) {
52 alert('Oops, an error occurred. ' + xhr.statusText + ' - ' +
53 xhr.responseText);
54 }
55 });
56 }
57 }
58 return false;
59 });
60 });