Cleanup and fixes in templates

This commit is contained in:
Nathan Chapman 2021-02-06 09:07:47 -07:00
parent ee472fb9a0
commit 804a3daed7
7 changed files with 47 additions and 29 deletions

View File

@ -5,11 +5,16 @@
<section class="panel"> <section class="panel">
<h1>{{ user.first_name }} {{ user.last_name }}</h1> <h1>{{ user.first_name }} {{ user.last_name }}</h1>
<p>{{ user.email }}</p> <p>{{ user.email }}</p>
{% if user.student %}
<p>{{ user.student.department }}</p>
{% elif user.instructor %}
<p>{{ user.instructor.department }}</p>
{% endif %}
{% if periods %} {% if periods %}
<p>Total clocked hours: <strong>{{ periods.total|timedelta_format }}</strong></p> <p>Total clocked hours: <strong>{{ periods.total|timedelta_format }}</strong></p>
{% endif %} {% endif %}
<p> <p>
<a href="{% url 'account-update' user.id %}">Update</a> <a href="{% url 'account-update' user.id %}">Update email/change password</a>
</p> </p>
</section> </section>
{% endblock %} {% endblock %}

View File

@ -3,6 +3,7 @@
<thead> <thead>
<tr> <tr>
<th>Station</th> <th>Station</th>
<th>Date</th>
<th>Clocked in</th> <th>Clocked in</th>
<th>Clocked out</th> <th>Clocked out</th>
<th>Duration</th> <th>Duration</th>
@ -13,9 +14,10 @@
{% if period.clocked_out %} {% if period.clocked_out %}
<tr> <tr>
<td>{{ period.station_number }}</td> <td>{{ period.station_number }}</td>
<td>{{ period.clocked_in }}</td> <td>{{ period.clocked_in|date:"M d, y" }}</td>
<td>{{ period.clocked_in|time:"P" }}</td>
{% if period.clocked_out %} {% if period.clocked_out %}
<td>{{ period.clocked_out }}</td> <td>{{ period.clocked_out|time:"P" }}</td>
<td>{{ period.clocked_in|timesince:period.clocked_out }}</td> <td>{{ period.clocked_in|timesince:period.clocked_out }}</td>
{% else %} {% else %}
<td colspan="2">Current sesson: {{ period.clocked_in|timesince }}</td> <td colspan="2">Current sesson: {{ period.clocked_in|timesince }}</td>

View File

@ -20,8 +20,7 @@
</section> </section>
<section class="student__attendance attendance"> <section class="student__attendance attendance">
<h2 class="attendance__title">Attendance log</h2> <h2 class="attendance__title">Attendance log</h2>
<p class="attendance__total">Total hours for the month: <strong>{{ period_total.total|timedelta_format:2 }}</strong><br> <p class="attendance__total">Total hours for the month: <strong>{{ period_total.total|timedelta_format:2 }}</strong> <small>(Does not include current session.)</small></p>
<small>(Does not include current session.)</small></p>
{% include 'attendance/_student_periods.html' %} {% include 'attendance/_student_periods.html' %}
</section> </section>
</article> </article>

View File

@ -2,5 +2,23 @@
{% load static %} {% load static %}
{% block content %} {% block content %}
<h1>Welcome home</h1> <article class="home">
<header class="panel">
<h1>Welcome to<br>
Btech Time Tracker</h1>
<h2>Know exactly how many hours you've clocked, anytime, anywhere.</h2>
</header>
<section>
<h3>No more paper</h3>
<p>No more reading bad handwriting or putting the wrong date or time.</p>
</section>
<section>
<h3>No more questions</h3>
<p>No more asking your instructor, or being asked by your student how many hours they have.</p>
</section>
<section>
<h3>No more manual entry</h3>
<p>We invented computers to do that for us.</p>
</section>
</article>
{% endblock %} {% endblock %}

View File

@ -1,6 +1,7 @@
.navbar { .navbar {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center;
margin: 1rem; margin: 1rem;
&__logo { &__logo {
@ -8,20 +9,8 @@
font-size: 1rem; font-size: 1rem;
} }
&__nav { &__user {
margin-right: 1rem;
} }
} }
.nav {
&nav__user {
}
&nav__logout {
}
&nav__login {
}
}

View File

@ -4,6 +4,7 @@
@import "forms"; @import "forms";
@import "nav"; @import "nav";
@import "messages"; @import "messages";
@import "home";
@import "registration"; @import "registration";
@import "students"; @import "students";
@import "instructors"; @import "instructors";

View File

@ -18,17 +18,21 @@
{% endcompress %} {% endcompress %}
</head> </head>
<body> <body>
<header class="navbar"> <header>
<span class="navbar__logo">BTech Time Tracker</span> <nav class="navbar">
<nav class="navbar__nav nav"> <span class="navbar__logo">BTech Time Tracker</span>
{% if user.is_authenticated %} {% if user.is_authenticated %}
<a class="nav__user" href="{% url 'account-detail' user.id %}">{{ user.first_name }} {{ user.last_name }}</a> / <div>
<a href="{% url 'attendance-overview' %}">Attendance</a> / <a href="{% url 'attendance-overview' %}">Attendance</a> /
<a href="{% url 'attendance-update' %}">Clock</a> / <a href="{% url 'attendance-update' %}">Clock</a> /
<a href="{% url 'account-list' %}">Users</a> / <a href="{% url 'account-list' %}">Users</a>
<a class="nav__logout" class="logout" href="{% url 'logout' %}">Logout</a> </div>
<div>
<a class="navbar__user" href="{% url 'account-detail' user.id %}">{{ user.first_name }} {{ user.last_name }}</a>
<a class="navbar__logout action-button" class="logout" href="{% url 'logout' %}">Logout</a>
</div>
{% else %} {% else %}
<a class="nav__login" class="login" href="{% url 'login' %}">Login</a> <a class="navbar__login action-button" class="login" href="{% url 'login' %}">Login</a>
{% endif %} {% endif %}
</nav> </nav>
</header> </header>