moderate.js 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. $(document).ready(function(){
  2. $('ul#moderate_tags li.tag a.accept, ul#moderate_tags li.tag a.refuse').click(function(){
  3. link = $(this);
  4. $.getJSON($(this).attr('href'), function(response) {
  5. if (response.status == 'mustbeconnected')
  6. {
  7. $(location).attr('href', url_index);
  8. }
  9. if (response.status == 'success')
  10. {
  11. link.parent('li').remove();
  12. }
  13. if (response.status == 'error')
  14. {
  15. alert(response.message);
  16. }
  17. });
  18. return false;
  19. });
  20. $('ul#moderate_tags li.tag a.replace').click(function(){
  21. link = $(this);
  22. newtag = link.parent('li').find('input.tagBox_tags_ids').val();
  23. $.getJSON($(this).attr('href')+'/'+newtag, function(response) {
  24. if (response.status == 'mustbeconnected')
  25. {
  26. $(location).attr('href', url_index);
  27. }
  28. if (response.status == 'error')
  29. {
  30. alert(response.message);
  31. }
  32. if (response.status == 'success')
  33. {
  34. link.parent('li').remove();
  35. }
  36. });
  37. return false;
  38. });
  39. $('ul#moderate_elements li.element div.controls a.delete').live('click', function(){
  40. li = $(this).parent('div.controls').parent('li.element');
  41. $.getJSON($(this).attr('href'), function(response) {
  42. if (response.status == 'success')
  43. {
  44. li.slideUp(500, function(){li.remove();});
  45. }
  46. else
  47. {
  48. alert(response.status);
  49. }
  50. });
  51. return false;
  52. });
  53. $('ul#moderate_elements li.element div.controls a.clean').live('click', function(){
  54. li = $(this).parent('div.controls').parent('li.element');
  55. $.getJSON($(this).attr('href'), function(response) {
  56. if (response.status == 'success')
  57. {
  58. li.slideUp(500, function(){li.remove();});
  59. }
  60. else
  61. {
  62. alert(response.status);
  63. }
  64. });
  65. return false;
  66. });
  67. });