Commit 7dcf36c2 by Giulio Gratta

added simple confirm dialog for unflagging

parent 93e3ce55
...@@ -16,36 +16,18 @@ class OpenEnded ...@@ -16,36 +16,18 @@ class OpenEnded
@ban_button = $('.ban-button') @ban_button = $('.ban-button')
@unflag_button = $('.unflag-button') @unflag_button = $('.unflag-button')
@ban_button.click @ban @ban_button.click @ban
@unflag_button.click @confirm_unflag @unflag_button.click @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: (event) => unflag: (event) =>
event.preventDefault() if confirm "Are you sure you want to unflag this submission?"
parent_tr = $(event.target).parent().parent() event.preventDefault()
tr_children = parent_tr.children() parent_tr = $(event.target).parent().parent()
action_type = "unflag" tr_children = parent_tr.children()
submission_id = parent_tr.data('submission-id') action_type = "unflag"
student_id = parent_tr.data('student-id') submission_id = parent_tr.data('submission-id')
callback_func = @after_action_wrapper($(event.target), action_type) student_id = parent_tr.data('student-id')
@post('take_action_on_flags', {'submission_id' : submission_id, 'student_id' : student_id, 'action_type' : action_type}, callback_func) 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) => ban: (event) =>
event.preventDefault() event.preventDefault()
......
...@@ -56,17 +56,4 @@ ...@@ -56,17 +56,4 @@
%endif %endif
%endif %endif
</div> </div>
</section> </section>
\ No newline at end of file
<!-- 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
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