Commit 8e9ec501 by Vik Paruchuri

Implement flagging, fix urls

parent 10c7155d
...@@ -226,7 +226,7 @@ def flagged_problem_list(request, course_id): ...@@ -226,7 +226,7 @@ def flagged_problem_list(request, course_id):
error_text = "Could not get problem list" error_text = "Could not get problem list"
success = False success = False
ajax_url = _reverse_with_slash('open_ended_problems', course_id) ajax_url = _reverse_with_slash('open_ended_flagged_problems', course_id)
return render_to_response('open_ended_problems/open_ended_flagged_problems.html', { return render_to_response('open_ended_problems/open_ended_flagged_problems.html', {
'course': course, 'course': course,
...@@ -308,7 +308,6 @@ def take_action_on_flags(request, course_id): ...@@ -308,7 +308,6 @@ def take_action_on_flags(request, course_id):
student_id = p['student_id'] student_id = p['student_id']
try: try:
controller_qs = ControllerQueryService()
response = controller_qs.take_action_on_flags(course_id, student_id, submission_id, action_type) response = controller_qs.take_action_on_flags(course_id, student_id, submission_id, action_type)
return HttpResponse(response, mimetype="application/json") return HttpResponse(response, mimetype="application/json")
except GradingServiceError: except GradingServiceError:
......
...@@ -24,13 +24,22 @@ class OpenEnded ...@@ -24,13 +24,22 @@ class OpenEnded
ban: (event) => ban: (event) =>
event.preventDefault() event.preventDefault()
@gentle_alert "Ban" parent_tr = $(event.target).parent().parent()
tr_children = parent_tr.children()
action_type = "ban"
submission_id = tr_children[4].innerText
student_id = tr_children[5].innerText
@gentle_alert student_id
@post('take_action_on_flags', {'submission_id' : submission_id, 'student_id' : student_id, 'action_type' : action_type}, @handle_after_action)
post: (cmd, data, callback) -> post: (cmd, data, callback) ->
# if this post request fails, the error callback will catch it # if this post request fails, the error callback will catch it
$.post(@ajax_url + cmd, data, callback) $.post(@ajax_url + cmd, data, callback)
.error => callback({success: false, error: "Error occured while performing this operation"}) .error => callback({success: false, error: "Error occured while performing this operation"})
handle_after_action: (data) ->
@gentle_alert data
gentle_alert: (msg) => gentle_alert: (msg) =>
if $('.message-container').length if $('.message-container').length
$('.message-container').remove() $('.message-container').remove()
......
...@@ -289,7 +289,7 @@ if settings.COURSEWARE_ENABLED: ...@@ -289,7 +289,7 @@ if settings.COURSEWARE_ENABLED:
# Open Ended flagged problem list # Open Ended flagged problem list
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems$',
'open_ended_grading.views.flagged_problem_list', name='open_ended_flagged_problems'), 'open_ended_grading.views.flagged_problem_list', name='open_ended_flagged_problems'),
url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems/take_action_on_flag$', url(r'^courses/(?P<course_id>[^/]+/[^/]+/[^/]+)/open_ended_flagged_problems/take_action_on_flags$',
'open_ended_grading.views.take_action_on_flags', name='open_ended_flagged_problems_take_action'), 'open_ended_grading.views.take_action_on_flags', name='open_ended_flagged_problems_take_action'),
# Cohorts management # Cohorts management
......
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