Refactor collection detail template: streamline case management links and enhance layout for better usability
This commit is contained in:
@@ -1,34 +1,6 @@
|
||||
{% extends 'atlas/exams.html' %}
|
||||
|
||||
{% load partials %}
|
||||
|
||||
{% partialdef casedetails-management-links %}
|
||||
|
||||
(<a href="{% url 'atlas:collection_case_displaysetup' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-display" title="Setup default display"></i></a>
|
||||
|
||||
{% if casedetail.default_viewerstate %}
|
||||
<i class="bi bi-check text-success" title="This case has a default viewerstate defined"></i>
|
||||
{% endif %}
|
||||
)
|
||||
|
||||
(<a href="{% url 'atlas:collection_case_details' casedetail.collection.pk casedetail.case.pk %}"><i class="bi bi-info-square" title="Case details"></i></a>)
|
||||
|
||||
{% if collection.collection_type == "QUE" %}
|
||||
(<a href='{% url "atlas:collection_case_questions" casedetail.collection.pk casedetail.case.pk %}'>
|
||||
{% if casedetail.question_schema %}
|
||||
<i class="bi bi-question-square text-success" title="This case has questions defined."></i>
|
||||
{% else %}
|
||||
<i class="bi bi-question-square text-danger" title="This case has no questions defined."></i>
|
||||
{% endif %}
|
||||
</a>
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
{% if casedetail.case.previous_case %}
|
||||
(<a href='{% url "atlas:collection_case_priors" casedetail.collection.pk casedetail.case.pk %}'>
|
||||
<i class="bi bi-link-45deg" title="Manage priors"></i></a>)
|
||||
{% endif %}
|
||||
{% endpartialdef %}
|
||||
{# per-case management links removed here; will include via separate partial to keep template logic simple #}
|
||||
|
||||
{% block content %}
|
||||
<h2>{{collection.name}}</h2>
|
||||
@@ -36,107 +8,108 @@
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
<div>
|
||||
Exam mode: {{collection.exam_mode}} (open access: {{collection.exam_open_access}})<br />
|
||||
{% include "generic/partials/exams/exam_status.html#publish-results" %}
|
||||
{% include "generic/partials/exams/exam_status.html#exam-active" %}
|
||||
Collection Type: {{collection.get_collection_type_display}}<br />
|
||||
Self review: {{collection.self_review}}<br />
|
||||
Open access: {{collection.open_access}}<br />
|
||||
{% if collection.prerequisites.exists %}
|
||||
Prerequisite collections:
|
||||
<ul>
|
||||
{% for prereq in collection.prerequisites.all %}
|
||||
<li>
|
||||
<a href="{% url 'atlas:collection_detail' prereq.pk %}">{{ prereq.name }}</a>
|
||||
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<div class="container">
|
||||
<div class="row mb-3">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-body d-flex justify-content-between align-items-center">
|
||||
<div>
|
||||
<h2 class="mb-0">{{ collection.name }}</h2>
|
||||
<div class="small text-muted">Type: {{ collection.get_collection_type_display }} · Mode: {{ collection.exam_mode }}</div>
|
||||
</div>
|
||||
<div class="text-end">
|
||||
{% if collection.collection_type == "VIV" %}
|
||||
<a class="btn btn-sm btn-primary" href="{% url 'atlas:collection_viva' collection.pk %}">Start Viva</a>
|
||||
{% else %}
|
||||
<a id="take-url" class="btn btn-sm btn-outline-primary me-2" href="{{ collection.get_take_url }}">Take / View</a>
|
||||
<button _="on click writeText(#take-url's href) on navigator.clipboard" class="btn btn-sm btn-secondary">Copy link</button>
|
||||
<a class="btn btn-sm btn-outline-secondary" href='{% url "atlas:collection_viva" collection.pk %}'>Review collection here</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<button
|
||||
title="Sync users from all prerequisite collections into this collection"
|
||||
hx-post="{% url 'atlas:collection_sync_prerequisite_users' collection.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
class="btn btn-sm btn-secondary"
|
||||
>Sync prerequisite users</button>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="row">
|
||||
<main class="col-md-8">
|
||||
{% include 'exam_notes.html' %}
|
||||
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">Cases</div>
|
||||
<div class="card-body p-0">
|
||||
<ol id="full-question-list" class="list-group list-group-numbered mb-0 sortable">
|
||||
{% for casedetail in casesdetails %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start" data-question_pk="{{ casedetail.case.pk }}">
|
||||
<div class="ms-2 me-auto">
|
||||
<div>
|
||||
<a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{ forloop.counter }}</a>:
|
||||
{% if casedetail.case.series.count == 0 %}
|
||||
<i class="bi bi-exclamation-circle text-warning ms-2" title="No series attached to this case"></i>
|
||||
{% endif %}
|
||||
<strong class="ms-2">{{ casedetail.case.title }}</strong>
|
||||
</div>
|
||||
<div class="small text-muted mt-1">{% include 'atlas/partials/casedetails_management_links.html' %}</div>
|
||||
</div>
|
||||
</li>
|
||||
{% empty %}
|
||||
<li class="list-group-item">No cases in this collection.</li>
|
||||
{% endfor %}
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if collection.collection_type == "VIV" %}
|
||||
<p><a href='{% url "atlas:collection_viva" collection.pk %}'><button class="btn btn-primary">Start Viva</button></a>
|
||||
{% else %}
|
||||
<p>This collection will be available to view/take <a href='{{collection.get_take_url}}' id="take-url">here</a>{% if not collection.active %} (when active){% endif %} <button
|
||||
_="on click
|
||||
writeText(#take-url's href) on navigator.clipboard
|
||||
put 'copied url!' into me
|
||||
wait 1s
|
||||
put 'copy url' into me"
|
||||
class="btn btn-sm">copy link</button>
|
||||
<p>Review collection <a href='{% url "atlas:collection_viva" collection.pk %}'>here</a>
|
||||
{% endif %}
|
||||
{% include 'exam_overview_js.html' %}
|
||||
</main>
|
||||
|
||||
<aside class="col-md-4">
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">Details & Settings</div>
|
||||
<div class="card-body">
|
||||
<p class="mb-1"><strong>Open access:</strong> {{ collection.open_access }}</p>
|
||||
<p class="mb-1"><strong>Self review:</strong> {{ collection.self_review }}</p>
|
||||
<p class="mb-1"><strong>Exam open access:</strong> {{ collection.exam_open_access }}</p>
|
||||
{% include "generic/partials/exams/exam_status.html#publish-results" %}
|
||||
{% include "generic/partials/exams/exam_status.html#exam-active" %}
|
||||
|
||||
{% if collection.prerequisites.exists %}
|
||||
<hr />
|
||||
<div class="mb-2"><strong>Prerequisite collections</strong></div>
|
||||
<ul class="list-unstyled">
|
||||
{% for prereq in collection.prerequisites.all %}
|
||||
<li><a href="{% url 'atlas:collection_detail' prereq.pk %}">{{ prereq.name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p>
|
||||
<button title="Sync users from all prerequisite collections into this collection" hx-post="{% url 'atlas:collection_sync_prerequisite_users' collection.pk %}" hx-swap="outerHTML" class="btn btn-sm btn-secondary">Sync prerequisite users</button>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if can_edit %}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">Management</div>
|
||||
<div class="card-body">
|
||||
<div class="d-grid gap-2">
|
||||
<button id="button-edit-order" title="click and drag questions to change order" data-posturl="{% url 'atlas:exam_json_edit' pk=collection.pk %}" class="btn btn-outline-secondary btn-sm">Edit case order / Remove cases</button>
|
||||
<button id="button-add-case" title="click to add a case to this collection" hx-get="{% url 'atlas:add_case_to_collection' collection.pk %}" hx-swap="innerHTML" hx-target="#case-list" class="btn btn-primary btn-sm">Add case</button>
|
||||
</div>
|
||||
<div id="case-list" class="mt-2"></div>
|
||||
|
||||
<h3>Cases</h3>
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for casedetail in casesdetails %}
|
||||
<li data-question_pk={{casedetail.case.pk}}>
|
||||
|
||||
|
||||
<a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>
|
||||
:
|
||||
{% if casedetail.case.series.count == 0 %}
|
||||
<i class="bi bi-exclamation-circle text-warning" title="No series attached to this case"></i>
|
||||
{% endif %}
|
||||
{{casedetail.case.title}}
|
||||
|
||||
{% partial casedetails-management-links %}
|
||||
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
</ol>
|
||||
|
||||
|
||||
|
||||
|
||||
{% if can_edit %}
|
||||
<p><button id='button-edit-order' title='click and drag questions to change order' data-posturl="{% url 'atlas:exam_json_edit' pk=collection.pk %}">Edit case order / Remove cases</button></p>
|
||||
<p><button id='button-add-case'
|
||||
title='click to add a case to this collection'
|
||||
hx-get="{% url 'atlas:add_case_to_collection' collection.pk %}" hx-swap="innerHTML" hx-target="#case-list">
|
||||
Add case
|
||||
</button>
|
||||
<div id='case-list'></div>
|
||||
</p>
|
||||
|
||||
<details>
|
||||
<summary>Answer management</summary>
|
||||
|
||||
<div class="alert alert-danger">
|
||||
<p>Manage answers for this collection. </p>
|
||||
|
||||
Please note these are permanant and cannot be undone.
|
||||
<details class="mt-3">
|
||||
<summary>Answer management</summary>
|
||||
<div class="alert alert-danger mt-2">Manage answers for this collection. Please note these are permanent and cannot be undone.</div>
|
||||
<div class="d-grid gap-2 mt-2">
|
||||
<button title="This will clear all user answers and attempts" hx-post="{% url 'atlas:collection_reset_answers' collection.pk %}" hx-swap="outerHTML" hx-confirm="Are you sure you want to reset all answers? This action cannot be undone." class="btn btn-danger btn-sm">Reset all answers</button>
|
||||
<button title="This will specific user answers and attempts" hx-post="{% url 'atlas:collection_reset_answers_user_list' collection.pk %}" hx-swap="innerHTML" hx-target="#user-list" class="btn btn-warning btn-sm">Reset user answers</button>
|
||||
</div>
|
||||
<div id="user-list" class="mt-2"></div>
|
||||
</details>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
</aside>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button title="This will clear all user answers and attempts"
|
||||
hx-post="{% url 'atlas:collection_reset_answers' collection.pk %}"
|
||||
hx-swap="outerHTML"
|
||||
hx-confirm="Are you sure you want to reset all answers? This action cannot be undone."
|
||||
>Reset all answers</button>
|
||||
|
||||
<button title="This will specific user answers and attempts"
|
||||
hx-post="{% url 'atlas:collection_reset_answers_user_list' collection.pk %}"
|
||||
hx-swap="innerHTML"
|
||||
hx-target="#user-list"
|
||||
>Reset user answers</button>
|
||||
<div id="user-list"></div>
|
||||
|
||||
</details>
|
||||
{% endif %}
|
||||
{% include 'exam_overview_js.html' %}
|
||||
{% endblock %}
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user