diff options
author | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 16:10:06 +0100 |
---|---|---|
committer | Matthew Lemon <lemon@matthewlemon.com> | 2020-10-23 16:10:06 +0100 |
commit | 247a88d2d129a83a8891ae0d356e23d513259e14 (patch) | |
tree | 79500433d083764176c0cccb81641776e4c75c11 | |
parent | 0b52f8d4c49302716915b4a2d756c49688b8d727 (diff) |
improved CAF detail page
-rw-r--r-- | ctrack/caf/templates/caf/caf_detail.html | 46 | ||||
-rw-r--r-- | ctrack/caf/views.py | 2 |
2 files changed, 17 insertions, 31 deletions
diff --git a/ctrack/caf/templates/caf/caf_detail.html b/ctrack/caf/templates/caf/caf_detail.html index 53b7efe..52da584 100644 --- a/ctrack/caf/templates/caf/caf_detail.html +++ b/ctrack/caf/templates/caf/caf_detail.html @@ -8,49 +8,25 @@ <div class="row justify-content-center"> <div class="col"> - <div class="row"> - <div class="col-md-12"> - <h4 class="mb-2 p-2">{{ object }}</h4> - </div> - </div> + <h4 class="mb-2">{{ object }}</h4> </div> </div> <div class="row"> <div class="col-12"> - {% if tde and sde %} - <h3>History:</h3> - <div class="row"> - <div class="col-md-12"> - No events registered for this CAF. - <span class="float-right pb-1"><a href="#" type="button" class="btn btn-outline-primary btn-sm">Register Event</a></span> - </div> - </div> - {% endif %} <div class="row"> <div class="col-md-12 my-1"> + <h5>Key Events:</h5> <ul class="list-group"> - {% for event in twin_date_events %} - {% if event.end_date %} - <li class="list-group-item list-group-item-success"><a - href="#">{{ event.type }}</a> - <span class="float-right">Completed: {{ event.end_date|date:"j M Y" }}</span></li> - {% else %} - <li class="list-group-item list-group-item-warning"><a - href="#">{{ event.type }}</a> - <span class="float-right">Started: {{ event.date|date:"j M Y" }}</span></li> - {% endif %} - {% endfor %} - {% for event in single_date_events %} - <li class="list-group-item list-group-item-{{ event.badge_code }}"> - <a href="#">{{ event.type }}</a> + {% for event in all_events %} + <li class="list-group-item bg bg-light"> + {{ event.type_descriptor }} <span class="float-right">Completed: {{ event.date|date:"j M Y" }}</span></li> </li> {% endfor %} </ul> </div> </div> - </ul> </div> </div> @@ -113,7 +89,8 @@ d="M3.5 0a.5.5 0 0 1 .5.5V1h8V.5a.5.5 0 0 1 1 0V1h1a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H2a2 2 0 0 1-2-2V3a2 2 0 0 1 2-2h1V.5a.5.5 0 0 1 .5-.5zM1 4v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V4H1z"/> <path d="M6.445 11.688V6.354h-.633A12.6 12.6 0 0 0 4.5 7.16v.695c.375-.257.969-.62 1.258-.777h.012v4.61h.675zm1.188-1.305c.047.64.594 1.406 1.703 1.406 1.258 0 2-1.066 2-2.871 0-1.934-.781-2.668-1.953-2.668-.926 0-1.797.672-1.797 1.809 0 1.16.824 1.77 1.676 1.77.746 0 1.23-.376 1.383-.79h.027c-.004 1.316-.461 2.164-1.305 2.164-.664 0-1.008-.45-1.05-.82h-.684zm2.953-2.317c0 .696-.559 1.18-1.184 1.18-.601 0-1.144-.383-1.144-1.2 0-.823.582-1.21 1.168-1.21.633 0 1.16.398 1.16 1.23z"/> </svg> - <a href="{% url "register:event_caf_create_single_date_event_from_caf" object.id %}">New Single Date Event</a> | + <a href="{% url "register:event_caf_create_single_date_event_from_caf" object.id %}">New Single Date Event</a> + | <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-calendar-range" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> <path fill-rule="evenodd" @@ -170,6 +147,7 @@ </div> </div> </div> + </div> <div class="row"> <div class="col-md-12 my-2"> @@ -181,6 +159,13 @@ new...</a></div> <div> <table class="table table-bordered"> + <thead> + <tr> + <th>Name</th> + <th>Description</th> + </tr> + </thead> + <tbody> {% if systems|length > 0 %} {% for system in systems %} <tr> @@ -196,6 +181,7 @@ <a class="btn btn-primary" href="{% url "caf:as_create_from_org" organisation.slug %}" role="button">Add new...</a> {% endif %} + </tbody> </table> </div> </div> diff --git a/ctrack/caf/views.py b/ctrack/caf/views.py index e8479ab..eb74036 100644 --- a/ctrack/caf/views.py +++ b/ctrack/caf/views.py @@ -27,7 +27,7 @@ def caf_detail_view(request, pk): # caf_principles = CAFPrinciple.objects.all() _scrs = [] _events = list(itertools.chain(caf.cafsingledateevent_set.all(), caf.caftwindateevent_set.all())) - all_events = sorted(_events, key=lambda x: x.date, reverse=True) + all_events = sorted(_events, key=lambda x: x.date, reverse=False) for ass in assessments: lst_scores = [ass, CAFAssessmentOutcomeScore.objects.filter(caf_assessment=ass)] _scrs.append(lst_scores) |