Commit 66b8e1fc by Sarina Canelake

Merge pull request #1195 from edx/sarina/more-ins-dash

Sarina/more ins dash
parents e2b54b7a 1251003d
...@@ -19,6 +19,9 @@ editing capability for a course's list of tabs. ...@@ -19,6 +19,9 @@ editing capability for a course's list of tabs.
Studio and LMS: add ability to lock assets (cannot be viewed unless registered Studio and LMS: add ability to lock assets (cannot be viewed unless registered
for class). for class).
LMS: First round of improvements to New (beta) Instructor Dash:
improvements, fixes, and internationalization to the Student Info section.
LMS: Improved accessibility of parts of forum navigation sidebar. LMS: Improved accessibility of parts of forum navigation sidebar.
LMS: enhanced accessibility labeling and aria support for the discussion forum LMS: enhanced accessibility labeling and aria support for the discussion forum
......
...@@ -121,7 +121,6 @@ def _section_student_admin(course_id, access): ...@@ -121,7 +121,6 @@ def _section_student_admin(course_id, access):
'section_display_name': _('Student Admin'), 'section_display_name': _('Student Admin'),
'access': access, 'access': access,
'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': course_id}), 'get_student_progress_url_url': reverse('get_student_progress_url', kwargs={'course_id': course_id}),
'enrollment_url': reverse('students_update_enrollment', kwargs={'course_id': course_id}),
'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': course_id}), 'reset_student_attempts_url': reverse('reset_student_attempts', kwargs={'course_id': course_id}),
'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': course_id}), 'rescore_problem_url': reverse('rescore_problem', kwargs={'course_id': course_id}),
'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_id}), 'list_instructor_tasks_url': reverse('list_instructor_tasks', kwargs={'course_id': course_id}),
......
...@@ -9,12 +9,6 @@ std_ajax_err = -> window.InstructorDashboard.util.std_ajax_err.apply this, argum ...@@ -9,12 +9,6 @@ std_ajax_err = -> window.InstructorDashboard.util.std_ajax_err.apply this, argum
load_IntervalManager = -> window.InstructorDashboard.util.IntervalManager load_IntervalManager = -> window.InstructorDashboard.util.IntervalManager
# wrap window.confirm
# display `msg`
# run `ok` or `cancel` depending on response
confirm_then = ({msg, ok, cancel}) ->
if window.confirm msg then ok?() else cancel?()
# get jquery element and assert its existance # get jquery element and assert its existance
find_and_assert = ($root, selector) -> find_and_assert = ($root, selector) ->
item = $root.find selector item = $root.find selector
...@@ -85,8 +79,6 @@ class StudentAdmin ...@@ -85,8 +79,6 @@ class StudentAdmin
@$progress_link = find_and_assert @$section, "a.progress-link" @$progress_link = find_and_assert @$section, "a.progress-link"
@$field_problem_select_single = find_and_assert @$section, "input[name='problem-select-single']" @$field_problem_select_single = find_and_assert @$section, "input[name='problem-select-single']"
@$btn_reset_attempts_single = find_and_assert @$section, "input[name='reset-attempts-single']" @$btn_reset_attempts_single = find_and_assert @$section, "input[name='reset-attempts-single']"
@$btn_enroll = @$section.find "input[name='enroll']"
@$btn_unenroll = @$section.find "input[name='unenroll']"
@$btn_delete_state_single = @$section.find "input[name='delete-state-single']" @$btn_delete_state_single = @$section.find "input[name='delete-state-single']"
@$btn_rescore_problem_single = @$section.find "input[name='rescore-problem-single']" @$btn_rescore_problem_single = @$section.find "input[name='rescore-problem-single']"
@$btn_task_history_single = @$section.find "input[name='task-history-single']" @$btn_task_history_single = @$section.find "input[name='task-history-single']"
...@@ -121,7 +113,9 @@ class StudentAdmin ...@@ -121,7 +113,9 @@ class StudentAdmin
e.preventDefault() e.preventDefault()
unique_student_identifier = @$field_student_select_progress.val() unique_student_identifier = @$field_student_select_progress.val()
if not unique_student_identifier if not unique_student_identifier
return @$request_response_error_progress.text "Please enter a student email address or username." return @$request_response_error_progress.text gettext("Please enter a student email address or username.")
error_message = gettext("Error getting student progress url for '<%= student_id %>'. Check that the student identifier is spelled correctly.")
full_error_message = _.template(error_message, {student_id: unique_student_identifier})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
...@@ -129,77 +123,59 @@ class StudentAdmin ...@@ -129,77 +123,59 @@ class StudentAdmin
data: unique_student_identifier: unique_student_identifier data: unique_student_identifier: unique_student_identifier
success: @clear_errors_then (data) -> success: @clear_errors_then (data) ->
window.location = data.progress_url window.location = data.progress_url
error: std_ajax_err => @$request_response_error_progress.text "Error getting student progress url for '#{unique_student_identifier}'." error: std_ajax_err => @$request_response_error_progress.text full_error_message
# enroll student
@$btn_enroll.click =>
send_data =
action: 'enroll'
emails: @$field_student_select_progress.val()
auto_enroll: false
$.ajax
dataType: 'json'
url: @$btn_enroll.data 'endpoint'
data: send_data
success: @clear_errors_then -> console.log "student #{send_data.emails} enrolled"
error: std_ajax_err => @$request_response_error_progress.text "Error enrolling student '#{send_data.emails}'."
# unenroll student
@$btn_unenroll.click =>
send_data =
action: 'unenroll'
emails: @$field_student_select_progress.val()
$.ajax
dataType: 'json'
url: @$btn_unenroll.data 'endpoint'
data: send_data
success: @clear_errors_then -> console.log "student #{send_data.emails} unenrolled"
error: std_ajax_err => @$request_response_error_progress.text "Error unenrolling student '#{send_data.emails}'."
# reset attempts for student on problem # reset attempts for student on problem
@$btn_reset_attempts_single.click => @$btn_reset_attempts_single.click =>
unique_student_identifier = @$field_student_select_grade.val() unique_student_identifier = @$field_student_select_grade.val()
problem_to_reset = @$field_problem_select_single.val() problem_to_reset = @$field_problem_select_single.val()
if not unique_student_identifier if not unique_student_identifier
return @$request_response_error_grade.text "Please enter a student email address or username." return @$request_response_error_grade.text gettext("Please enter a student email address or username.")
if not problem_to_reset if not problem_to_reset
return @$request_response_error_grade.text "Please enter a problem urlname." return @$request_response_error_grade.text gettext("Please enter a problem urlname.")
send_data = send_data =
unique_student_identifier: unique_student_identifier unique_student_identifier: unique_student_identifier
problem_to_reset: problem_to_reset problem_to_reset: problem_to_reset
delete_module: false delete_module: false
success_message = gettext("Success! Problem attempts reset for problem '<%= problem_id %>' and student '<%= student_id %>'.")
error_message = gettext("Error resetting problem attempts for problem '<%= problem_id %>' and student '<%= student_id %>'. Check that the problem and student identifiers are spelled correctly.")
full_success_message = _.template(success_message, {problem_id: problem_to_reset, student_id: unique_student_identifier})
full_error_message = _.template(error_message, {problem_id: problem_to_reset, student_id: unique_student_identifier})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
url: @$btn_reset_attempts_single.data 'endpoint' url: @$btn_reset_attempts_single.data 'endpoint'
data: send_data data: send_data
success: @clear_errors_then -> alert "Success! Problem attempts reset for problem '#{problem_to_reset}' and student '#{unique_student_identifier}'." success: @clear_errors_then -> alert full_success_message
error: std_ajax_err => @$request_response_error_grade.text "Error resetting problem attempts for problem '#{problem_to_reset}' and student '#{unique_student_identifier}'." error: std_ajax_err => @$request_response_error_grade.text full_error_message
# delete state for student on problem # delete state for student on problem
@$btn_delete_state_single.click => @$btn_delete_state_single.click =>
unique_student_identifier = @$field_student_select_grade.val() unique_student_identifier = @$field_student_select_grade.val()
problem_to_reset = @$field_problem_select_single.val() problem_to_reset = @$field_problem_select_single.val()
if not unique_student_identifier if not unique_student_identifier
return @$request_response_error_grade.text "Please enter a student email address or username." return @$request_response_error_grade.text gettext("Please enter a student email address or username.")
if not problem_to_reset if not problem_to_reset
return @$request_response_error_grade.text "Please enter a problem urlname." return @$request_response_error_grade.text gettext("Please enter a problem urlname.")
confirm_message = gettext("Delete student '<%= student_id %>'s state on problem '<%= problem_id %>'?")
full_confirm_message = _.template(confirm_message, {student_id: unique_student_identifier, problem_id: problem_to_reset})
if window.confirm "Delete student '#{unique_student_identifier}'s state on problem '#{problem_to_reset}'?" if window.confirm full_confirm_message
send_data = send_data =
unique_student_identifier: unique_student_identifier unique_student_identifier: unique_student_identifier
problem_to_reset: problem_to_reset problem_to_reset: problem_to_reset
delete_module: true delete_module: true
error_message = gettext("Error deleting student '<%= student_id %>'s state on problem '<%= problem_id %>'. Check that the problem and student identifiers are spelled correctly.")
full_error_message = _.template(error_message, {student_id: unique_student_identifier, problem_id: problem_to_reset})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
url: @$btn_delete_state_single.data 'endpoint' url: @$btn_delete_state_single.data 'endpoint'
data: send_data data: send_data
success: @clear_errors_then -> alert 'Module state successfully deleted.' success: @clear_errors_then -> alert gettext('Module state successfully deleted.')
error: std_ajax_err => @$request_response_error_grade.text "Error deleting problem state." error: std_ajax_err => @$request_response_error_grade.text full_error_message
else else
# Clear error messages if "Cancel" was chosen on confirmation alert
@clear_errors() @clear_errors()
# start task to rescore problem for student # start task to rescore problem for student
...@@ -207,31 +183,37 @@ class StudentAdmin ...@@ -207,31 +183,37 @@ class StudentAdmin
unique_student_identifier = @$field_student_select_grade.val() unique_student_identifier = @$field_student_select_grade.val()
problem_to_reset = @$field_problem_select_single.val() problem_to_reset = @$field_problem_select_single.val()
if not unique_student_identifier if not unique_student_identifier
return @$request_response_error_grade.text "Please enter a student email address or username." return @$request_response_error_grade.text gettext("Please enter a student email address or username.")
if not problem_to_reset if not problem_to_reset
return @$request_response_error_grade.text "Please enter a problem urlname." return @$request_response_error_grade.text gettext("Please enter a problem urlname.")
send_data = send_data =
unique_student_identifier: unique_student_identifier unique_student_identifier: unique_student_identifier
problem_to_reset: problem_to_reset problem_to_reset: problem_to_reset
success_message = gettext("Started rescore problem task for problem '<%= problem_id %>' and student '<%= student_id %>'. Click the 'Show Background Task History for Student' button to see the status of the task.")
full_success_message = _.template(success_message, {student_id: unique_student_identifier, problem_id: problem_to_reset})
error_message = gettext("Error starting a task to rescore problem '<%= problem_id %>' for student '<%= student_id %>'. Check that the problem and student identifiers are spelled correctly.")
full_error_message = _.template(error_message, {student_id: unique_student_identifier, problem_id: problem_to_reset})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
url: @$btn_rescore_problem_single.data 'endpoint' url: @$btn_rescore_problem_single.data 'endpoint'
data: send_data data: send_data
success: @clear_errors_then -> alert "Started rescore problem task for problem '#{problem_to_reset}' and student '#{unique_student_identifier}'. Click the 'Show Background Task History for Student' button to see the status of the task." success: @clear_errors_then -> alert full_success_message
error: std_ajax_err => @$request_response_error_grade.text "Error starting a task to rescore problem '#{problem_to_reset}' for student '#{unique_student_identifier}'." error: std_ajax_err => @$request_response_error_grade.text full_error_message
# list task history for student+problem # list task history for student+problem
@$btn_task_history_single.click => @$btn_task_history_single.click =>
unique_student_identifier = @$field_student_select_grade.val() unique_student_identifier = @$field_student_select_grade.val()
problem_to_reset = @$field_problem_select_single.val() problem_to_reset = @$field_problem_select_single.val()
if not unique_student_identifier if not unique_student_identifier
return @$request_response_error_grade.text "Please enter a student email address or username." return @$request_response_error_grade.text gettext("Please enter a student email address or username.")
if not problem_to_reset if not problem_to_reset
return @$request_response_error_grade.text "Please enter a problem urlname." return @$request_response_error_grade.text gettext("Please enter a problem urlname.")
send_data = send_data =
unique_student_identifier: unique_student_identifier unique_student_identifier: unique_student_identifier
problem_urlname: problem_to_reset problem_urlname: problem_to_reset
error_message = gettext("Error getting task history for problem '<%= problem_id %>' and student '<%= student_id %>'. Check that the problem and student identifiers are spelled correctly.")
full_error_message = _.template(error_message, {student_id: unique_student_identifier, problem_id: problem_to_reset})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
...@@ -239,44 +221,58 @@ class StudentAdmin ...@@ -239,44 +221,58 @@ class StudentAdmin
data: send_data data: send_data
success: @clear_errors_then (data) => success: @clear_errors_then (data) =>
create_task_list_table @$table_task_history_single, data.tasks create_task_list_table @$table_task_history_single, data.tasks
error: std_ajax_err => @$request_response_error_grade.text "Error getting task history for student '#{unique_student_identifier}' and problem '#{problem_to_reset}'." error: std_ajax_err => @$request_response_error_grade.text full_error_message
# start task to reset attempts on problem for all students # start task to reset attempts on problem for all students
@$btn_reset_attempts_all.click => @$btn_reset_attempts_all.click =>
problem_to_reset = @$field_problem_select_all.val() problem_to_reset = @$field_problem_select_all.val()
if not problem_to_reset if not problem_to_reset
return @$request_response_error_all.text "Please enter a problem urlname." return @$request_response_error_all.text gettext("Please enter a problem urlname.")
if window.confirm "Reset attempts for all students on problem '#{@$field_problem_select_all.val()}'?" confirm_message = gettext("Reset attempts for all students on problem '<%= problem_id %>'?")
full_confirm_message = _.template(confirm_message, {problem_id: problem_to_reset})
if window.confirm full_confirm_message
send_data = send_data =
all_students: true all_students: true
problem_to_reset: problem_to_reset problem_to_reset: problem_to_reset
success_message = gettext("Successfully started task to reset attempts for problem '<%= problem_id %>'. Click the 'Show Background Task History for Problem' button to see the status of the task.")
full_success_message = _.template(success_message, {problem_id: problem_to_reset})
error_message = gettext("Error starting a task to reset attempts for all students on problem '<%= problem_id %>'. Check that the problem identifier is spelled correctly.")
full_error_message = _.template(error_message, {problem_id: problem_to_reset})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
url: @$btn_reset_attempts_all.data 'endpoint' url: @$btn_reset_attempts_all.data 'endpoint'
data: send_data data: send_data
success: @clear_errors_then -> alert "Successfully started task to reset attempts for problem '#{problem_to_reset}'. Click the 'Show Background Task History for Problem' button to see the status of the task." success: @clear_errors_then -> alert full_success_message
error: std_ajax_err => @$request_response_error_all.text "Error starting a task to reset attempts for all students on this problem." error: std_ajax_err => @$request_response_error_all.text full_error_message
else else
# Clear error messages if "Cancel" was chosen on confirmation alert
@clear_errors() @clear_errors()
# start task to rescore problem for all students # start task to rescore problem for all students
@$btn_rescore_problem_all.click => @$btn_rescore_problem_all.click =>
problem_to_reset = @$field_problem_select_all.val() problem_to_reset = @$field_problem_select_all.val()
if not problem_to_reset if not problem_to_reset
return @$request_response_error_all.text "Please enter a problem urlname." return @$request_response_error_all.text gettext("Please enter a problem urlname.")
if window.confirm "Rescore problem '#{@$field_problem_select_all.val()}' for all students?" confirm_message = gettext("Rescore problem '<%= problem_id %>' for all students?")
full_confirm_message = _.template(confirm_message, {problem_id: problem_to_reset})
if window.confirm full_confirm_message
send_data = send_data =
all_students: true all_students: true
problem_to_reset: problem_to_reset problem_to_reset: problem_to_reset
success_message = gettext("Successfully started task to rescore problem '<%= problem_id %>' for all students. Click the 'Show Background Task History for Problem' button to see the status of the task.")
full_success_message = _.template(success_message, {problem_id: problem_to_reset})
error_message = gettext("Error starting a task to rescore problem '<%= problem_id %>'. Check that the problem identifier is spelled correctly.")
full_error_message = _.template(error_message, {problem_id: problem_to_reset})
$.ajax $.ajax
dataType: 'json' dataType: 'json'
url: @$btn_rescore_problem_all.data 'endpoint' url: @$btn_rescore_problem_all.data 'endpoint'
data: send_data data: send_data
success: @clear_errors_then -> alert "Successfully started task to rescore problem '#{problem_to_reset}' for all students. Click the 'Show Background Task History for Problem' button to see the status of the task." success: @clear_errors_then -> alert full_success_message
error: std_ajax_err => @$request_response_error_all.text "Error starting a task to rescore this problem for all students." error: std_ajax_err => @$request_response_error_all.text full_error_message
else else
# Clear error messages if "Cancel" was chosen on confirmation alert
@clear_errors() @clear_errors()
# list task history for problem # list task history for problem
...@@ -285,7 +281,7 @@ class StudentAdmin ...@@ -285,7 +281,7 @@ class StudentAdmin
problem_urlname: @$field_problem_select_all.val() problem_urlname: @$field_problem_select_all.val()
if not send_data.problem_urlname if not send_data.problem_urlname
return @$request_response_error_all.text "Please enter a problem urlname." return @$request_response_error_all.text gettext("Please enter a problem urlname.")
$.ajax $.ajax
dataType: 'json' dataType: 'json'
...@@ -293,7 +289,7 @@ class StudentAdmin ...@@ -293,7 +289,7 @@ class StudentAdmin
data: send_data data: send_data
success: @clear_errors_then (data) => success: @clear_errors_then (data) =>
create_task_list_table @$table_task_history_all, data.tasks create_task_list_table @$table_task_history_all, data.tasks
error: std_ajax_err => @$request_response_error_all.text "Error listing task history for this student and problem." error: std_ajax_err => @$request_response_error_all.text gettext("Error listing task history for this student and problem.")
reload_running_tasks_list: => reload_running_tasks_list: =>
list_endpoint = @$table_running_tasks.data 'endpoint' list_endpoint = @$table_running_tasks.data 'endpoint'
......
...@@ -18,15 +18,6 @@ ...@@ -18,15 +18,6 @@
<a href="" class="progress-link" data-endpoint="${ section_data['get_student_progress_url_url'] }"> ${_("Student Progress Page")} </a> <a href="" class="progress-link" data-endpoint="${ section_data['get_student_progress_url_url'] }"> ${_("Student Progress Page")} </a>
</p> </p>
</div> </div>
<br>
<!-- These buttons don't appear to be working
<p>
${_("Click to enroll or unenroll this student from the course:")}
<input type="button" name="enroll" value="${_("Enroll")}" data-endpoint="${ section_data['enrollment_url'] }">
<input type="button" name="unenroll" value="${_("Unenroll")}" data-endpoint="${ section_data['enrollment_url'] }">
</p>
-->
<hr> <hr>
</div> </div>
...@@ -59,7 +50,6 @@ ...@@ -59,7 +50,6 @@
</p> </p>
<p> <p>
<!-- Doesn't give any type of notification upon success -->
<input type="button" name="reset-attempts-single" value="${_("Reset Student Attempts")}" data-endpoint="${ section_data['reset_student_attempts_url'] }"> <input type="button" name="reset-attempts-single" value="${_("Reset Student Attempts")}" data-endpoint="${ section_data['reset_student_attempts_url'] }">
%if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']: %if settings.MITX_FEATURES.get('ENABLE_INSTRUCTOR_BACKGROUND_TASKS') and section_data['access']['instructor']:
......
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