allow ordering of case collections
This commit is contained in:
@@ -9,15 +9,20 @@
|
||||
Self review: {{collection.self_review}}<br />
|
||||
</div>
|
||||
<h3>Cases</h3>
|
||||
<ul>
|
||||
<ol id="full-question-list" class="sortable">
|
||||
{% for case in cases %}
|
||||
<li><a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>
|
||||
<li data-question_pk={{case.pk}}><a href="{% url 'atlas:collection_case_view' pk=collection.pk case_number=forloop.counter0 %}">Case {{forloop.counter}}</a>
|
||||
: {{case.title}}
|
||||
</li>
|
||||
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</ol>
|
||||
|
||||
<p>This collection will be available to view/take <a href='{{collection.get_take_url}}'>here</a>
|
||||
|
||||
{% 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 / Delete cases</button></p>
|
||||
{% endif %}
|
||||
{% include 'exam_overview_js.html' %}
|
||||
{% endblock %}
|
||||
|
||||
+1
-1
@@ -1097,7 +1097,7 @@ def collection_detail(request, pk):
|
||||
return render(
|
||||
request,
|
||||
"atlas/collection_detail.html",
|
||||
{"collection": collection, "cases": cases},
|
||||
{"collection": collection, "cases": cases, "can_edit": True},
|
||||
)
|
||||
|
||||
|
||||
|
||||
+9
-2
@@ -42,7 +42,7 @@ from django_filters.views import FilterView
|
||||
from django_filters import FilterSet, OrderingFilter, ModelMultipleChoiceFilter
|
||||
from django_tables2.views import SingleTableMixin
|
||||
from reversion.views import RevisionMixin
|
||||
from atlas.models import CaseCollection
|
||||
from atlas.models import CaseCollection, CaseDetail
|
||||
from generic.decorators import user_is_cid_user_manager
|
||||
from generic.filters import CidUserFilter, ExaminationFilter
|
||||
|
||||
@@ -1195,7 +1195,14 @@ class ExamViews(View, LoginRequiredMixin):
|
||||
# data = {"status": "error, count does not match"}
|
||||
# return JsonResponse(data, status=400)
|
||||
|
||||
exam.exam_questions.set(objects)
|
||||
if self.app_name == "atlas":
|
||||
exam.cases.set(objects)
|
||||
for n, case in enumerate(objects):
|
||||
case_detail = CaseDetail.objects.get(case=case, collection=exam)
|
||||
case_detail.sort_order = n
|
||||
case_detail.save()
|
||||
else:
|
||||
exam.exam_questions.set(objects)
|
||||
exam.save()
|
||||
data = {"status": "success"}
|
||||
return JsonResponse(data, status=200)
|
||||
|
||||
@@ -559,6 +559,11 @@ td.user-answer-score-2.rapid-ans::after {
|
||||
max-width: 120px;
|
||||
}
|
||||
|
||||
.series-block-thumbnail img {
|
||||
max-width: 80px;
|
||||
max-height: 80px;
|
||||
}
|
||||
|
||||
.series-block-examination {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user