diff options
author | Sanmugasundaram K | 2015-05-07 15:24:25 +0530 |
---|---|---|
committer | Sanmugasundaram K | 2015-05-07 15:24:25 +0530 |
commit | 30d80e37ee5604196f465c2b2c73b1d1a4f11f79 (patch) | |
tree | fc4f4d803fd177fb17927cd94d6ffd08f46e38fe /static/website/js/thread-user.js | |
parent | 8f29c847f23aef4b21a803766064d59289603196 (diff) | |
download | spoken-tutorial-forums-30d80e37ee5604196f465c2b2c73b1d1a4f11f79.tar.gz spoken-tutorial-forums-30d80e37ee5604196f465c2b2c73b1d1a4f11f79.tar.bz2 spoken-tutorial-forums-30d80e37ee5604196f465c2b2c73b1d1a4f11f79.zip |
question delete, hide, show feature
Diffstat (limited to 'static/website/js/thread-user.js')
-rw-r--r-- | static/website/js/thread-user.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/static/website/js/thread-user.js b/static/website/js/thread-user.js index 1c43342..32e7fae 100644 --- a/static/website/js/thread-user.js +++ b/static/website/js/thread-user.js @@ -14,6 +14,8 @@ $(document).ready(function() { */ $saving = $(".saving"); $saved= $(".saved"); + $deleted= $(".deleted"); + $hide_qmsg= $(".hide-qmsg"); $question = $(".question"); $question_modify = $(".question .modify"); $question_edit = $(".question .modify .edit"); @@ -305,4 +307,47 @@ $(document).ready(function() { $form.submit(); e.preventDefault; }); + /* delete */ + $('.delete-question').on('click', function(e){ + question_id = parseInt($('.delete-question').data("qid")); + $('#confirm-delete').modal({ backdrop: 'static', keyboard: false }) + .one('click', '#delete', function() { + $.ajax({ + url: "/ajax-delete-question/", + type: "POST", + data: { + question_id: question_id, + }, + success: function(data) { + $deleted.hide(); + $deleted.show(); + $deleted.fadeOut(10000); + window.location = '/'; + } + }); + }); + }); + + /* hide */ + $('.hide-question').on('click', function(e){ + question_id = parseInt($('.hide-question').data("qid")); + status = parseInt($('.hide-question').data("status")); + $('#confirm-hide').modal({ backdrop: 'static', keyboard: false }) + .one('click', '#chide', function() { + $.ajax({ + url: "/ajax-hide-question/", + type: "POST", + data: { + question_id: question_id, + status : status, + }, + success: function(data) { + $hide_qmsg.hide(); + $hide_qmsg.show(); + $hide_qmsg.fadeOut(10000); + window.location.reload(); + } + }); + }); + }); }); |