Commit 7dcf36c2 by Giulio Gratta

added simple confirm dialog for unflagging

parent 93e3ce55
......@@ -16,36 +16,18 @@ class OpenEnded
@ban_button = $('.ban-button')
@unflag_button = $('.unflag-button')
@ban_button.click @ban
@unflag_button.click @confirm_unflag
@unflag_submission_confirmation = $('.flag-submission-confirmation')
@unflag_submission_cancel_button = $('.flag-submission-confirmation-button')
@unflag_submission_confirmation_button = $('.flag-submission-removal-button')
@unflag_submission_confirmation.hide()
@unflag_submission_cancel_button.click @close_dialog_box()
@unflag_submission_confirmation_button.click @remove_flag()
remove_flag: () =>
@unflag()
@close_dialog_box()
close_dialog_box: () =>
$( ".flag-submission-confirmation" ).dialog('close')
confirm_unflag: () =>
$( ".flag-submission-confirmation" ).dialog({ height: 275, width: 400 })
@unflag_button.click @unflag
unflag: (event) =>
event.preventDefault()
parent_tr = $(event.target).parent().parent()
tr_children = parent_tr.children()
action_type = "unflag"
submission_id = parent_tr.data('submission-id')
student_id = parent_tr.data('student-id')
callback_func = @after_action_wrapper($(event.target), action_type)
@post('take_action_on_flags', {'submission_id' : submission_id, 'student_id' : student_id, 'action_type' : action_type}, callback_func)
if confirm "Are you sure you want to unflag this submission?"
event.preventDefault()
parent_tr = $(event.target).parent().parent()
tr_children = parent_tr.children()
action_type = "unflag"
submission_id = parent_tr.data('submission-id')
student_id = parent_tr.data('student-id')
callback_func = @after_action_wrapper($(event.target), action_type)
@post('take_action_on_flags', {'submission_id' : submission_id, 'student_id' : student_id, 'action_type' : action_type}, callback_func)
ban: (event) =>
event.preventDefault()
......
......@@ -56,17 +56,4 @@
%endif
%endif
</div>
</section>
<!-- Flag submission confirmation dialog -->
<section class="flag-submission-confirmation" style="display: none;">
<br />
<h4> Are you sure that you want to unflag this submission?</h4>
<br />
<p>You are about to unflag a submission. Please confirm, or cancel below.</p>
<br />
<div>
<input type="button" class="flag-submission-removal-button" value="Remove Flag" name="calibration-interstitial-page-button" />
<input type="button" class="flag-submission-confirmation-button" value="Keep Flag" name="calibration-interstitial-page-button" />
</div>
</section>
\ No newline at end of file
</section>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment