diff --git a/smash/web/models/study_subject_list.py b/smash/web/models/study_subject_list.py index de31e3cf04711d7909c80f56019597ef59605cb3..8813f34b1ac1bb0d5b86dd937779de26dbf79fd7 100644 --- a/smash/web/models/study_subject_list.py +++ b/smash/web/models/study_subject_list.py @@ -9,7 +9,7 @@ SUBJECT_LIST_REQUIRE_CONTACT = "REQUIRE_CONTACT" SUBJECT_LIST_VOUCHER_EXPIRY = "VOUCHER_EXPIRY" SUBJECT_LIST_CHOICES = { - SUBJECT_LIST_GENERIC: 'Generic', + SUBJECT_LIST_GENERIC: 'Generic subject list', SUBJECT_LIST_NO_VISIT: 'Subjects without visit', SUBJECT_LIST_REQUIRE_CONTACT: 'Subjects required contact', SUBJECT_LIST_VOUCHER_EXPIRY: 'Subject with vouchers to be expired soon' diff --git a/smash/web/templates/subjects/index.html b/smash/web/templates/subjects/index.html index b3b4aaa0e0067bce58fcf61b60877ae8a2402610..4033c02dd8abdf84127be23da9a6441906c667d4 100644 --- a/smash/web/templates/subjects/index.html +++ b/smash/web/templates/subjects/index.html @@ -8,10 +8,10 @@ {% endblock styles %} {% block ui_active_tab %}'subjects'{% endblock ui_active_tab %} -{% block page_header %}Subjects{% endblock page_header %} +{% block page_header %}{{ list_description }}{% endblock page_header %} {% block page_description %}{% endblock page_description %} -{% block title %}{{ block.super }} - Subjects{% endblock %} +{% block title %}{{ block.super }} - {{ list_description }}{% endblock %} {% block breadcrumb %} {% include "subjects/breadcrumb.html" %} diff --git a/smash/web/views/subject.py b/smash/web/views/subject.py index f8df4c1af40bbf68dd9012676ad5d7fb516b4ce2..4237d946668ea4ca628ceb3078eb55b3071440c1 100644 --- a/smash/web/views/subject.py +++ b/smash/web/views/subject.py @@ -9,19 +9,24 @@ from ..forms import VisitDetailForm, SubjectAddForm, SubjectEditForm, StudySubje from ..models import StudySubject, MailTemplate, Worker, Study from ..models.constants import GLOBAL_STUDY_ID from ..models.study_subject_list import SUBJECT_LIST_GENERIC, SUBJECT_LIST_NO_VISIT, SUBJECT_LIST_REQUIRE_CONTACT, \ - SUBJECT_LIST_VOUCHER_EXPIRY + SUBJECT_LIST_VOUCHER_EXPIRY, SUBJECT_LIST_CHOICES logger = logging.getLogger(__name__) -def subjects(request): +def subject_list(request, subject_list_type): context = { - 'list_type': SUBJECT_LIST_GENERIC, - 'worker': Worker.get_by_user(request.user) + 'list_type': subject_list_type, + 'worker': Worker.get_by_user(request.user), + 'list_description': SUBJECT_LIST_CHOICES[subject_list_type], } return wrap_response(request, 'subjects/index.html', context) +def subjects(request): + return subject_list(request, SUBJECT_LIST_GENERIC) + + def subject_add(request): study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0] if request.method == 'POST': @@ -47,24 +52,15 @@ def subject_add(request): def subject_no_visits(request): - context = { - 'list_type': SUBJECT_LIST_NO_VISIT, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_NO_VISIT) def subject_voucher_expiry(request): - context = { - 'list_type': SUBJECT_LIST_VOUCHER_EXPIRY, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_VOUCHER_EXPIRY) def subject_require_contact(request): - context = { - 'list_type': SUBJECT_LIST_REQUIRE_CONTACT, - } - return wrap_response(request, 'subjects/index.html', context) + return subject_list(request, SUBJECT_LIST_REQUIRE_CONTACT) def subject_edit(request, id):