diff --git a/lms/djangoapps/open_ended_grading/views.py b/lms/djangoapps/open_ended_grading/views.py index aaee9f4c98..137cff7803 100644 --- a/lms/djangoapps/open_ended_grading/views.py +++ b/lms/djangoapps/open_ended_grading/views.py @@ -309,7 +309,7 @@ def take_action_on_flags(request, course_id): try: controller_qs = ControllerQueryService() - response = controller_qs.take_action_on_flags(course_id, student_id, course_id, action_type) + response = controller_qs.take_action_on_flags(course_id, student_id, submission_id, action_type) return HttpResponse(response, mimetype="application/json") except GradingServiceError: log.exception("Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}".format(location, submission_id, submission_key, grader_id)) diff --git a/lms/static/coffee/src/open_ended/open_ended.coffee b/lms/static/coffee/src/open_ended/open_ended.coffee new file mode 100644 index 0000000000..f45efeb8a7 --- /dev/null +++ b/lms/static/coffee/src/open_ended/open_ended.coffee @@ -0,0 +1,33 @@ +# This is a simple class that just hides the error container +# and message container when they are empty +# Can (and should be) expanded upon when our problem list +# becomes more sophisticated +class OpenEnded + constructor: (ajax_url) -> + @ajax_url = ajax_url + @error_container = $('.error-container') + @error_container.toggle(not @error_container.is(':empty')) + + @message_container = $('.message-container') + @message_container.toggle(not @message_container.is(':empty')) + + @problem_list = $('.problem-list') + + @ban_button = $('.ban-button') + @unflag_button = $('.unflag-button') + @ban_button.click @ban + @unflag_button.click @unflag + + unflag: (event) => + event.preventDefault() + + ban: (event) => + event.preventDefault() + + post: (cmd, data, callback) -> + # if this post request fails, the error callback will catch it + $.post(@ajax_url + cmd, data, callback) + .error => callback({success: false, error: "Error occured while performing this operation"}) + +ajax_url = $('.open-ended-problems').data('ajax_url') +$(document).ready(() -> new OpenEnded(ajax_url)) diff --git a/lms/templates/open_ended_problems/open_ended_flagged_problems.html b/lms/templates/open_ended_problems/open_ended_flagged_problems.html index 2397e1a70e..9265ad4663 100644 --- a/lms/templates/open_ended_problems/open_ended_flagged_problems.html +++ b/lms/templates/open_ended_problems/open_ended_flagged_problems.html @@ -10,6 +10,10 @@ <%include file="/courseware/course_navigation.html" args="active_page='open_ended_flagged_problems'" /> +<%block name="js_extra"> + <%static:js group='open_ended'/> + +
${error_text}
@@ -38,10 +42,10 @@ ${problem['student_response']} - Unflag + Unflag - Ban + Ban ${problem['submission_id']}