Refactor collection case view documentation and enhance management view with edit permissions
This commit is contained in:
+20
-22
@@ -4693,21 +4693,18 @@ def collection_case_view_take_user(request, pk, case_number=None, case_id=None):
|
||||
def collection_case_view_take(
|
||||
request, pk, case_number=None, cid=None, passcode=None, case_id=None
|
||||
):
|
||||
"""
|
||||
Displays the page from which the user takes a case in the collection
|
||||
"""Candidate-facing collection case taking/review screen.
|
||||
|
||||
Args:
|
||||
request (_type_): _description_
|
||||
pk (int): _description_
|
||||
case_number (int): _description_
|
||||
cid (_type_, optional): _description_. Defaults to None.
|
||||
passcode (_type_, optional): _description_. Defaults to None.
|
||||
This view is for end users taking a case (or reviewing their answers after
|
||||
completion). It should remain answer-focused and must not expose management
|
||||
edit controls for case content.
|
||||
|
||||
Supports either:
|
||||
- ``case_number``: zero-based index within the collection
|
||||
- ``case_id``: case PK (translated to the collection index)
|
||||
|
||||
Raises:
|
||||
Http404: If user does not have access
|
||||
|
||||
Returns:
|
||||
_type_: _description_
|
||||
Http404: If access is invalid or no case is specified.
|
||||
"""
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
@@ -4937,7 +4934,6 @@ def collection_case_view_take(
|
||||
# Determine whether any prior series will be shown to the candidate.
|
||||
has_priors = any(prior_flag for (_, prior_flag, _) in series_to_load)
|
||||
prior_count = prior_cases.count()
|
||||
|
||||
return render(
|
||||
request,
|
||||
"atlas/collection_case_view_take.html",
|
||||
@@ -4972,18 +4968,18 @@ def collection_case_view_take(
|
||||
|
||||
@user_is_collection_author_or_atlas_editor
|
||||
def collection_case_view(request, pk, case_number=None, case_id=None):
|
||||
"""Edit/management overview of the case (as part of the collection)
|
||||
"""Management view for a case within a collection.
|
||||
|
||||
Args:
|
||||
request (_type_): _description_
|
||||
pk (_type_): _description_
|
||||
case_number (_type_): _description_
|
||||
This view is used by collection authors/atlas editors to manage case
|
||||
content in collection context. It renders the full case detail template and
|
||||
provides ``can_edit`` for inline editing widgets/partials.
|
||||
|
||||
Supports either:
|
||||
- ``case_number``: zero-based index within the collection
|
||||
- ``case_id``: case PK (translated to the collection index)
|
||||
|
||||
Raises:
|
||||
Http404: _description_
|
||||
|
||||
Returns:
|
||||
_type_: _description_
|
||||
Http404: If no valid case is specified.
|
||||
"""
|
||||
collection = get_object_or_404(CaseCollection, pk=pk)
|
||||
|
||||
@@ -5013,6 +5009,7 @@ def collection_case_view(request, pk, case_number=None, case_id=None):
|
||||
|
||||
previous = collection.get_previous_case(casedetail.case)
|
||||
next = collection.get_next_case(casedetail.case)
|
||||
can_edit = case.check_user_can_edit(request.user)
|
||||
|
||||
return render(
|
||||
request,
|
||||
@@ -5027,6 +5024,7 @@ def collection_case_view(request, pk, case_number=None, case_id=None):
|
||||
"case_number": case_number,
|
||||
"previous": previous,
|
||||
"next": next,
|
||||
"can_edit": can_edit,
|
||||
"answer": answer,
|
||||
"cimar_sid": request.user.userprofile.cimar_sid,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user