Commit 0dd0f1f8 by Matjaz Gregoric

Hide 'Reset Attempts' and 'Rescore Problem' on unsupported blocks.

CAPA problems have the "Staff Debug Info" button, which allows
instructors to "Reset Attempts" and "Rescore problem" for any individual
student.

XBlocks, such as Drag and Drop v2 do not support those, though the UI
was still present. Clicking any of those links would result in an
"Unknown Error Occurred" message.

This commit hides the two buttons if the associated block does not
support them.
parent e3397671
......@@ -68,13 +68,17 @@ ${block_content}
</div>
<div data-location="${location | h}" data-location-name="${location.name | h}">
[
% if can_reset_attempts:
<a href="#" class="staff-debug-reset">${_('Reset Student Attempts')}</a>
% if has_instructor_access:
|
% endif
% if has_instructor_access:
<a href="#" class="staff-debug-sdelete">${_('Delete Student State')}</a>
% if can_rescore_problem:
|
<a href="#" class="staff-debug-rescore">${_('Rescore Student Submission')}</a>
% endif
% endif
]
</div>
<div id="result_${location.name | h}"/>
......
......@@ -382,6 +382,8 @@ def add_staff_markup(user, has_instructor_access, disable_staff_debug_info, bloc
'block_content': frag.content,
'is_released': is_released,
'has_instructor_access': has_instructor_access,
'can_reset_attempts': 'attempts' in block.fields,
'can_rescore_problem': hasattr(block, 'rescore_problem'),
'disable_staff_debug_info': disable_staff_debug_info,
}
return wrap_fragment(frag, render_to_string("staff_problem_info.html", staff_context))
......
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