Refactor actions section in case view template for improved readability and structure
This commit is contained in:
@@ -23,64 +23,64 @@
|
||||
View my <a href='{% url "atlas:case_view" %}?author={{request.user.id}}'>cases</a>.
|
||||
</details>
|
||||
<form>
|
||||
<details id="actions-detail" class="mt-3">
|
||||
<summary>
|
||||
<strong>Actions</strong>
|
||||
</summary>
|
||||
<div class="row mb-2">
|
||||
<div class="col-auto">
|
||||
<select id="collection-select" name="collection_id" class="form-select form-select-sm">
|
||||
<details id="actions-detail" class="mt-3">
|
||||
<summary>
|
||||
<strong>Actions</strong>
|
||||
</summary>
|
||||
<div class="row mb-2">
|
||||
<div class="col-auto">
|
||||
<select id="collection-select" name="collection_id" class="form-select form-select-sm">
|
||||
<!-- Dynamically load collection options via HTMX -->
|
||||
<option value="">Loading collections...</option>
|
||||
<option hx-trigger="every 1s[document.getElementById('actions-detail').open] once" hx-get="{% url 'atlas:collection_options' %}" hx-target="#collection-select" hx-swap="innerHTML"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button id="add-to-collection-btn"
|
||||
class="btn btn-sm btn-outline-primary"
|
||||
hx-post="{% url 'atlas:add_cases_to_collection' %}"
|
||||
hx-include="[name='selection']:checked, #collection-select"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Add selected cases to collection
|
||||
</button>
|
||||
<button id="remove-from-collection-btn"
|
||||
class="btn btn-sm btn-outline-danger ms-2"
|
||||
hx-post="{% url 'atlas:remove_cases_from_collection' %}"
|
||||
hx-include="[name='selection']:checked, #collection-select"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Remove selected cases from collection
|
||||
</button>
|
||||
<br/>
|
||||
<button id="set-open-access-btn"
|
||||
class="btn btn-sm btn-outline-success ms-2"
|
||||
hx-post="{% url 'atlas:set_open_access' %}"
|
||||
hx-include="[name='selection']:checked"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Set Open Access
|
||||
</button>
|
||||
<button id="remove-open-access-btn"
|
||||
class="btn btn-sm btn-outline-warning ms-2"
|
||||
hx-post="{% url 'atlas:remove_open_access' %}"
|
||||
hx-include="[name='selection']:checked"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Remove Open Access
|
||||
</button>
|
||||
<span id="action-result"></span>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
{% render_table table %}
|
||||
</form>
|
||||
<option value="">Loading collections...</option>
|
||||
<option hx-trigger="every 1s[document.getElementById('actions-detail').open] once" hx-get="{% url 'atlas:collection_options' %}" hx-target="#collection-select" hx-swap="innerHTML"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button id="add-to-collection-btn"
|
||||
class="btn btn-sm btn-outline-primary"
|
||||
hx-post="{% url 'atlas:add_cases_to_collection' %}"
|
||||
hx-include="[name='selection']:checked, #collection-select"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Add selected cases to collection
|
||||
</button>
|
||||
<button id="remove-from-collection-btn"
|
||||
class="btn btn-sm btn-outline-danger ms-2"
|
||||
hx-post="{% url 'atlas:remove_cases_from_collection' %}"
|
||||
hx-include="[name='selection']:checked, #collection-select"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Remove selected cases from collection
|
||||
</button>
|
||||
<br/>
|
||||
<button id="set-open-access-btn"
|
||||
class="btn btn-sm btn-outline-success ms-2"
|
||||
hx-post="{% url 'atlas:set_open_access' %}"
|
||||
hx-include="[name='selection']:checked"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Set Open Access
|
||||
</button>
|
||||
<button id="remove-open-access-btn"
|
||||
class="btn btn-sm btn-outline-warning ms-2"
|
||||
hx-post="{% url 'atlas:remove_open_access' %}"
|
||||
hx-include="[name='selection']:checked"
|
||||
hx-target="#action-result"
|
||||
hx-swap="innerHTML"
|
||||
>
|
||||
Remove Open Access
|
||||
</button>
|
||||
<span id="action-result"></span>
|
||||
</div>
|
||||
</div>
|
||||
</details>
|
||||
{% render_table table %}
|
||||
</form>
|
||||
|
||||
{% include "generic/partials/page_size_form.html" %}
|
||||
{% include "generic/partials/page_size_form.html" %}
|
||||
|
||||
<div id="exam-options"></div>
|
||||
<div id="exam-options"></div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -40,6 +40,7 @@ class QuestionTable(tables.Table):
|
||||
"author",
|
||||
)
|
||||
sequence = ("view", "stem", "answers")#, "exams")
|
||||
attrs = {"class": "table row-selector"}
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
super().__init__(
|
||||
|
||||
Reference in New Issue
Block a user