Clean up whitespace in various template files for consistency

This commit is contained in:
Ross
2026-01-26 12:49:04 +00:00
parent a667566db6
commit a61c8529ae
14 changed files with 201 additions and 178 deletions
+24
View File
@@ -434,6 +434,9 @@ class CaseCollectionTable(SelectionTable):
view = tables.LinkColumn(
"atlas:collection_detail", text="View", args=[A("pk")], orderable=False
)
created = tables.DateTimeColumn(verbose_name="Created", accessor="created", orderable=True)
updated = tables.DateTimeColumn(verbose_name="Updated", accessor="updated", orderable=True)
#clone = tables.LinkColumn(
# "atlas:case_clone", text="Clone", args=[A("pk")], orderable=False
#)
@@ -449,6 +452,8 @@ class CaseCollectionTable(SelectionTable):
template_name = "django_tables2/bootstrap4.html"
fields = (
"name",
"created",
"updated",
"collection_type",
"publish_results",
"active",
@@ -466,6 +471,25 @@ class CaseCollectionTable(SelectionTable):
**kwargs,
)
def render_created(self, value):
if not value:
return ""
# compact date for display, full datetime in tooltip
return format_html(
'<span class="small text-muted" title="{}">{}</span>',
value.strftime("%Y-%m-%d %H:%M"),
value.strftime("%Y-%m-%d"),
)
def render_updated(self, value):
if not value:
return ""
return format_html(
'<span class="small text-muted" title="{}">{}</span>',
value.strftime("%Y-%m-%d %H:%M"),
value.strftime("%Y-%m-%d"),
)
class QuestionSchemaTable(SelectionTable):
name = tables.Column(
linkify=("atlas:question_schema_detail", {"pk": tables.A("pk")}),
@@ -204,9 +204,9 @@
<h5>Resources</h5>
{% if can_edit%}
<div class="mb-2">
{% include 'atlas/partials/resource_search_panel.html' %}
</div>
<div class="mb-2">
{% include 'atlas/partials/resource_search_panel.html' %}
</div>
{% endif %}
<div>
+125 -125
View File
@@ -3,154 +3,154 @@
{% partialdef casedetails-management-links %}
<div class="btn-toolbar" role="toolbar" aria-label="Case management links">
{% include 'atlas/partials/casedetails_management_links.html' %}
</div>
<div class="btn-toolbar" role="toolbar" aria-label="Case management links">
{% include 'atlas/partials/casedetails_management_links.html' %}
</div>
{% endpartialdef %}
{% block content %}
<div class="container">
<div class="card mb-4">
<div class="card-body">
<div class="row">
<div class="col-md-8">
<h2 class="card-title mb-2">{{ collection.name }}</h2>
<div class="container">
<div class="card mb-4">
<div class="card-body">
<div class="row">
<div class="col-md-8">
<h2 class="card-title mb-2">{{ collection.name }}</h2>
{% include 'exam_notes.html' %}
{% include 'exam_notes.html' %}
<p class="mb-1">
<span class="badge bg-info text-dark me-2">{{ collection.exam_mode }}</span>
<small class="text-muted">(open access: {{ collection.exam_open_access }})</small>
</p>
<p class="mb-1">
<span class="badge bg-info text-dark me-2">{{ collection.exam_mode }}</span>
<small class="text-muted">(open access: {{ collection.exam_open_access }})</small>
</p>
<p class="mb-2">
{% include "generic/partials/exams/exam_status.html#publish-results" %}
{% include "generic/partials/exams/exam_status.html#exam-active" %}
</p>
<p class="mb-2">
{% include "generic/partials/exams/exam_status.html#publish-results" %}
{% include "generic/partials/exams/exam_status.html#exam-active" %}
</p>
<p class="mb-1">
<span class="badge bg-secondary me-2">{{ collection.get_collection_type_display }}</span>
<span class="badge bg-light text-dark me-2">Self review: {{ collection.self_review }}</span>
{% if collection.open_access %}
<span class="badge bg-success">Open</span>
{% else %}
<span class="badge bg-warning text-dark">Restricted</span>
{% endif %}
</p>
<p class="mb-1">
<span class="badge bg-secondary me-2">{{ collection.get_collection_type_display }}</span>
<span class="badge bg-light text-dark me-2">Self review: {{ collection.self_review }}</span>
{% if collection.open_access %}
<span class="badge bg-success">Open</span>
{% else %}
<span class="badge bg-warning text-dark">Restricted</span>
{% endif %}
</p>
{% if collection.prerequisites.exists %}
<div class="mt-3 mb-2">
<strong>Prerequisites</strong>
<ul class="mb-0">
{% for prereq in collection.prerequisites.all %}
<li><a href="{% url 'atlas:collection_detail' prereq.pk %}">{{ prereq.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
<div class="col-md-4 d-flex flex-column align-items-md-end mt-3 mt-md-0">
<div class="mb-2 w-100 text-md-end">
{% if collection.collection_type == "VIV" %}
<a href="{% url 'atlas:collection_viva' collection.pk %}" class="btn btn-primary mb-2">Start Viva</a>
{% else %}
<div class="d-inline-block">
<a class="btn btn-outline-secondary btn-sm" href="{{ collection.get_take_url }}" id="take-url-link">Open</a>
<button
_="on click
writeText(#take-url-link's href) on navigator.clipboard
put 'copied url!' into me
wait 1s
put 'copy link' into me"
class="btn btn-sm btn-outline-secondary ms-1">Copy link</button>
{% if collection.prerequisites.exists %}
<div class="mt-3 mb-2">
<strong>Prerequisites</strong>
<ul class="mb-0">
{% for prereq in collection.prerequisites.all %}
<li><a href="{% url 'atlas:collection_detail' prereq.pk %}">{{ prereq.name }}</a></li>
{% endfor %}
</ul>
</div>
{% endif %}
</div>
{% if collection.prerequisites.exists %}
<div class="w-100 text-md-end">
<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>
<div class="col-md-4 d-flex flex-column align-items-md-end mt-3 mt-md-0">
<div class="mb-2 w-100 text-md-end">
{% if collection.collection_type == "VIV" %}
<a href="{% url 'atlas:collection_viva' collection.pk %}" class="btn btn-primary mb-2">Start Viva</a>
{% else %}
<div class="d-inline-block">
<a class="btn btn-outline-secondary btn-sm" href="{{ collection.get_take_url }}" id="take-url-link">Open</a>
<button
_="on click
writeText(#take-url-link's href) on navigator.clipboard
put 'copied url!' into me
wait 1s
put 'copy link' into me"
class="btn btn-sm btn-outline-secondary ms-1">Copy link</button>
</div>
{% endif %}
</div>
{% endif %}
{% if collection.prerequisites.exists %}
<div class="w-100 text-md-end">
<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>
</div>
{% endif %}
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-12">
<h3 class="mb-3">Cases</h3>
<ol id="full-question-list" class="sortable list-group list-group-numbered">
{% for casedetail in casesdetails %}
{% include 'atlas/partials/case_list_item.html' %}
{% endfor %}
</ol>
</div>
</div>
{% if can_edit %}
<div class="row mt-4">
<div class="col-12 d-flex 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-sm btn-outline-secondary">
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-sm btn-secondary">
Add case
</button>
<div id='case-list'></div>
</div>
</div>
<div class="row mt-3">
<div class="row">
<div class="col-12">
<details>
<summary>Answer management</summary>
<h3 class="mb-3">Cases</h3>
<div class="alert alert-danger mt-3">
<p class="mb-1">Manage answers for this collection.</p>
<small class="text-muted">Please note these are permanent and cannot be undone.</small>
</div>
<div class="d-flex gap-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-3"></div>
</details>
<ol id="full-question-list" class="sortable list-group list-group-numbered">
{% for casedetail in casesdetails %}
{% include 'atlas/partials/case_list_item.html' %}
{% endfor %}
</ol>
</div>
</div>
{% endif %}
{% include 'exam_overview_js.html' %}
</div>
{% if can_edit %}
<div class="row mt-4">
<div class="col-12 d-flex 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-sm btn-outline-secondary">
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-sm btn-secondary">
Add case
</button>
<div id='case-list'></div>
</div>
</div>
<div class="row mt-3">
<div class="col-12">
<details>
<summary>Answer management</summary>
<div class="alert alert-danger mt-3">
<p class="mb-1">Manage answers for this collection.</p>
<small class="text-muted">Please note these are permanent and cannot be undone.</small>
</div>
<div class="d-flex gap-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-3"></div>
</details>
</div>
</div>
{% endif %}
{% include 'exam_overview_js.html' %}
</div>
{% endblock %}
+10 -11
View File
@@ -9,26 +9,26 @@
</div>
<style>
.embedded-viewer {
border: none;
pointer-events: auto;
margin: 0; height: 100%; overflow: hidden
}
</style>
<style>
.embedded-viewer {
border: none;
pointer-events: auto;
margin: 0; height: 100%; overflow: hidden
}
</style>
{% endpartialdef %}
{% partialdef embed %}
Close
Close
{% partial viewer %}
{% partial viewer %}
{% endpartialdef %}
{% block content %}
{% partial viewer %}
{% partial viewer %}
{% endblock content %}
@@ -36,4 +36,3 @@ Close
{% block css %}
{% endblock css %}
+19 -19
View File
@@ -2,15 +2,15 @@
{% partialdef login-block %}
Logging in here allows your account to be linked with CIMAR. You may periodically need to re-login to keep the link active.
<form method="POST" class="post-form" id="cimar-login-form">
Username: <input type="text" id="username" name="username" value=""/> <br/>
Password: <input type="password" id="password" name="password" value=""/> <br/>
<button hx-post='{% url "cimar_login" %}'
hx-target="#results">Login</button>
</form>
Logging in here allows your account to be linked with CIMAR. You may periodically need to re-login to keep the link active.
<form method="POST" class="post-form" id="cimar-login-form">
Username: <input type="text" id="username" name="username" value=""/> <br/>
Password: <input type="password" id="password" name="password" value=""/> <br/>
<button hx-post='{% url "cimar_login" %}'
hx-target="#results">Login</button>
</form>
<div id="results"></div>
<div id="results"></div>
{% endpartialdef %}
@@ -19,19 +19,19 @@ hx-target="#results">Login</button>
<div class="anatomy">
<h2>CIMAR login</h2>
Login status: {{ login_status }} ({{cimar_sid}})
<h2>CIMAR login</h2>
Login status: {{ login_status }} ({{cimar_sid}})
{% if login_status %}
<button
class="button btn-sm"
hx-get="{% url 'cimar_logout' %}"
hx-swap="outerHTML"
>Logout</button>
{% endif %}
<br/>
{% if login_status %}
<button
class="button btn-sm"
hx-get="{% url 'cimar_logout' %}"
hx-swap="outerHTML"
>Logout</button>
{% endif %}
<br/>
{% partial login-block %}
{% partial login-block %}
</div>
{% endblock %}