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