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">
<h1>{{ user.first_name }} {{ user.last_name }}</h1>
<p>{{ user.email }}</p>
{% if user.student %}
<p>{{ user.student.department }}</p>
{% elif user.instructor %}
<p>{{ user.instructor.department }}</p>
{% endif %}
{% if periods %}
<p>Total clocked hours: <strong>{{ periods.total|timedelta_format }}</strong></p>
{% endif %}
<p>
<a href="{% url 'account-update' user.id %}">Update</a>
<a href="{% url 'account-update' user.id %}">Update email/change password</a>
</p>
</section>
{% endblock %}

View File

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

View File

@ -20,8 +20,7 @@
</section>
<section class="student__attendance attendance">
<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>
<small>(Does not include current session.)</small></p>
<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>
{% include 'attendance/_student_periods.html' %}
</section>
</article>

View File

@ -2,5 +2,23 @@
{% load static %}
{% 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 %}

View File

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

View File

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

View File

@ -18,17 +18,21 @@
{% endcompress %}
</head>
<body>
<header class="navbar">
<header>
<nav class="navbar">
<span class="navbar__logo">BTech Time Tracker</span>
<nav class="navbar__nav nav">
{% 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-update' %}">Clock</a> /
<a href="{% url 'account-list' %}">Users</a> /
<a class="nav__logout" class="logout" href="{% url 'logout' %}">Logout</a>
<a href="{% url 'account-list' %}">Users</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 %}
<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 %}
</nav>
</header>