From f02439c65c32eb6170662d84cc8fcc8445339073 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Thu, 4 Feb 2021 22:00:48 -0700 Subject: [PATCH] Add more styles to student page --- accounts/templates/accounts/account_form.html | 9 +-- .../templates/attendance/_student_code.html | 21 ++++++ .../attendance/_student_periods.html | 29 +++++++++ .../attendance_overview_student.html | 64 ++++--------------- attendance/views.py | 2 - static/scss/_forms.scss | 3 + static/scss/_students.scss | 8 ++- .../registration/password_change_form.html | 4 +- 8 files changed, 80 insertions(+), 60 deletions(-) create mode 100644 attendance/templates/attendance/_student_code.html create mode 100644 attendance/templates/attendance/_student_periods.html diff --git a/accounts/templates/accounts/account_form.html b/accounts/templates/accounts/account_form.html index 083ffd0..6b3918a 100644 --- a/accounts/templates/accounts/account_form.html +++ b/accounts/templates/accounts/account_form.html @@ -1,19 +1,20 @@ {% extends 'application.html' %} {% block content %} -

Update User

+
+

Update User

-

{{ user.first_name }} {{ user.last_name }}

{% if user.student %}

Student ID: {{user.student.student_number}}

{% endif %} +

Change password

{% csrf_token %} {{ form.as_p }} - + or + Cancel
-

Change password

{% endblock %} diff --git a/attendance/templates/attendance/_student_code.html b/attendance/templates/attendance/_student_code.html new file mode 100644 index 0000000..5d0259e --- /dev/null +++ b/attendance/templates/attendance/_student_code.html @@ -0,0 +1,21 @@ +{% if user.student.code_set.last %} +

+ + {% if clocked_in %} + Clock out → + {% else %} + Clock in → + {% endif %} + +

+{% else %} +

+ + {% if clocked_in %} + Clock out → + {% else %} + Clock in → + {% endif %} + +

+{% endif %} diff --git a/attendance/templates/attendance/_student_periods.html b/attendance/templates/attendance/_student_periods.html new file mode 100644 index 0000000..d46eff2 --- /dev/null +++ b/attendance/templates/attendance/_student_periods.html @@ -0,0 +1,29 @@ + + + + + + + + + + + + {% for period in period_list %} + {% if period.clocked_out %} + + + + {% if period.clocked_out %} + + + {% else %} + + {% endif %} + + {% endif %} + {% empty %} + + {% endfor %} + +
{% now "F Y" %}
StationClocked inClocked outDuration
{{ period.station_number }}{{ period.clocked_in }}{{ period.clocked_out }}{{ period.clocked_in|timesince:period.clocked_out }}Current sesson: {{ period.clocked_in|timesince }}
No periods yet.
diff --git a/attendance/templates/attendance/attendance_overview_student.html b/attendance/templates/attendance/attendance_overview_student.html index bf49ee3..b371c6d 100644 --- a/attendance/templates/attendance/attendance_overview_student.html +++ b/attendance/templates/attendance/attendance_overview_student.html @@ -1,62 +1,22 @@

{{ user.student.department.name }}

- {% if user.student.is_clocked_in and user.student.code_set.last %} -

You are currently clocked in.
- Clocked in at: {{ current_period.clocked_in|date:"P" }}
- Current sesson: {{ current_period.clocked_in|timesince }}

-

- Clock out → -

- {% elif user.student.is_clocked_in and not user.student.code_set.last %} -

You are currently clocked in.
- Clocked in at: {{ current_period.clocked_in }}
- Current sesson: {{ current_period.clocked_in|timesince }}

-

- Clock out → -

- {% elif user.student.code_set.last %} -

You are not clocked in.

-

- Clock in → -

+ {% if user.student.is_clocked_in %} +
+

You are currently clocked in.

+

+ Clocked in at: {{ current_period.clocked_in|date:"P" }}
+ Current sesson: {{ current_period.clocked_in|timesince }} +

+
+ {% include 'attendance/_student_code.html' with clocked_in=True %} {% else %} -

You are not clocked in.

-

- Clock in → -

+
You are not clocked in.

+ {% include 'attendance/_student_code.html' with clocked_in=False %} {% endif %}

Attendance log

Total hours for the month: {{period_total}}
(Does not include current session.)

- - - - - - - - - - - - {% for period in period_list %} - {% if period.clocked_out %} - - - - {% if period.clocked_out %} - - - {% else %} - - {% endif %} - - {% endif %} - {% empty %} - - {% endfor %} - -
{% now "F Y" %}
StationClocked inClocked outDuration
{{ period.station_number }}{{ period.clocked_in }}{{ period.clocked_out }}{{ period.clocked_in|timesince:period.clocked_out }}Current sesson: {{ period.clocked_in|timesince }}
No periods yet.
+ {% include 'attendance/_student_periods.html' %}
diff --git a/attendance/views.py b/attendance/views.py index d79d950..1973ba5 100644 --- a/attendance/views.py +++ b/attendance/views.py @@ -44,8 +44,6 @@ class AttendanceOverview(LoginRequiredMixin, TemplateView): clocked_in__month=timezone.now().month ).aggregate(total_duration=Sum('duration')) - print(periods_duration_sum) - print(timezone.now().month) hours = 0 # Convert to hours floating point if periods_duration_sum['total_duration'] != None: diff --git a/static/scss/_forms.scss b/static/scss/_forms.scss index 788da3d..64d6852 100644 --- a/static/scss/_forms.scss +++ b/static/scss/_forms.scss @@ -14,6 +14,8 @@ input { outline: 0; } + + label { text-align: left; font-weight: 700; @@ -32,6 +34,7 @@ input[type=number], input[type=password], select[multiple=multiple], textarea { + display: block; text-align: left; color: $primary-color; border: 4px solid $grey; diff --git a/static/scss/_students.scss b/static/scss/_students.scss index ce50305..b396f87 100644 --- a/static/scss/_students.scss +++ b/static/scss/_students.scss @@ -9,8 +9,14 @@ &__department { margin-top: 0; } +} - &__clocked-in { +.status { + &__clocked { + + } + + &__clocked--clocked-in { background-color: $green; color: white; padding: 0.5rem; diff --git a/templates/registration/password_change_form.html b/templates/registration/password_change_form.html index a0810eb..beab783 100644 --- a/templates/registration/password_change_form.html +++ b/templates/registration/password_change_form.html @@ -2,11 +2,13 @@ {% block content %}
+

Change password

{% csrf_token %} {{ form.as_p }} - + or + Cancel
{% endblock %}