Commit 94e1a9ff by Diana Huang

Clean up some minor issues with list view

and display some new information on the problem-specific page
parent 48b90432
......@@ -80,7 +80,6 @@ class StaffGradingBackend
class StaffGrading
constructor: (backend) ->
@backend = backend
@list_view = true
# all the jquery selectors
......@@ -90,6 +89,7 @@ class StaffGrading
@error_container = $('.error-container')
@message_container = $('.message-container')
@prompt_name_container = $('.prompt-name')
@prompt_container = $('.prompt-container')
@prompt_wrapper = $('.prompt-wrapper')
......@@ -115,6 +115,9 @@ class StaffGrading
@max_score = 0
@ml_error_info= ''
@location = ''
@prompt_name = ''
@num_total = 0
@num_left = 0
@score = null
@problems = null
......@@ -164,7 +167,7 @@ class StaffGrading
if response.problem_list
@problems = response.problem_list
else if response.submission
@data_loaded(response.prompt, response.submission, response.rubric, response.submission_id, response.max_score, response.ml_error_info)
@data_loaded(response.prompt, response.submission, response.rubric, response.submission_id, response.max_score, response.ml_error_info, response.problem_name, response.num_left, response.num_total)
else
@no_more(response.message)
else
......@@ -178,6 +181,7 @@ class StaffGrading
@backend.post('get_next', {location}, @ajax_callback)
get_problem_list: () ->
@list_view = true
@backend.post('get_problem_list', {}, @ajax_callback)
submit_and_get_next: () ->
......@@ -192,7 +196,7 @@ class StaffGrading
@error_msg = msg
@state = state_error
data_loaded: (prompt, submission, rubric, submission_id, max_score, ml_error_info) ->
data_loaded: (prompt, submission, rubric, submission_id, max_score, ml_error_info, prompt_name, num_left, num_total) ->
@prompt = prompt
@submission = submission
@rubric = rubric
......@@ -201,12 +205,18 @@ class StaffGrading
@max_score = max_score
@score = null
@ml_error_info=ml_error_info
@prompt_name = prompt_name
@num_left = num_left
@num_total = num_total
@state = state_grading
if not @max_score?
@error("No max score specified for submission.")
no_more: (message) ->
@prompt = null
@prompt_name = ''
@num_left = 0
@num_total = 0
@submission = null
@rubric = null
@ml_error_info = null
......@@ -219,6 +229,7 @@ class StaffGrading
render_view: () ->
# clear the problem list
@problem_list.html('')
@problem_list_container.toggle(@list_view)
@message_container.html(@message)
# only show the grading elements when we are not in list view or the state
# is invalid
......@@ -260,6 +271,7 @@ class StaffGrading
else if @state == state_grading
@ml_error_info_container.html(@ml_error_info)
@prompt_container.html(@prompt)
@prompt_name_container.html("#{@prompt_name} (#{@num_left} / #{@num_total})")
@submission_container.html(@submission)
@rubric_container.html(@rubric)
......
......@@ -19,6 +19,8 @@
<div class="staff-grading" data-ajax_url="${ajax_url}">
<h1>Staff grading</h1>
<div class="breadcrumbs">
</div>
<div class="error-container">
</div>
......@@ -27,8 +29,13 @@
<div class="ml-error-info-container">
</div>
<div class="problem-list-container">
<ul class="problem-list">
</ul>
</div>
<section class="prompt-wrapper">
<h2 class="prompt-name"></h2>
<h3>Question prompt</h3>
<div class="prompt-container">
</div>
......
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