source: OpenWorkouts-current/ow/templates/dashboard.pt @ 31adfa5

currentfeature/docs
Last change on this file since 31adfa5 was 31adfa5, checked in by borja <borja@…>, 5 years ago

(#14) Timezones support:

  • Added pytz as a new dependency, please install it in your existing envs:

pip install pytz

  • Added a timezone attribute to users, to store in which timezone they are, defaults to 'UTC'. Ensure any users you could have in your database have such attribute. You can add it in pshell:

for user in root.users:

user.timezone = 'UTC'

request.tm.commit()

  • Modified schemas/templates/views to let users choose their timezone based on a list of "common" timezones provided by pytz
  • Added two methods to the Workout model so we can get the start and end dates formatted in the appropiate timezone (all datetime objects are stored in UTC)
  • Modified the templates where we show workout dates and times so the new timezone-formatting methods are used.
  • Property mode set to 100644
File size: 3.3 KB
Line 
1<html xmlns="http://www.w3.org/1999/xhtml"
2      xml:lang="en"
3      xmlns:tal="http://xml.zope.org/namespaces/tal"
4      xmlns:metal="http://xml.zope.org/namespaces/metal"
5      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
6      i18n:domain="OpenWorkouts"
7      metal:use-macro="load: base.pt"
8      tal:attributes="lang request.locale_name">
9
10  <metal:head-title metal:fill-slot="head-title">
11    <tal:t i18n:translate="">My dashboard</tal:t>
12  </metal:head-title>
13
14  <!--!
15      <metal:title metal:fill-slot="title">
16        <tal:t i18n:translate="">dashboard for user</tal:t>
17        <tal:user tal:content="context.fullname"></tal:user>
18      </metal:title>
19      -->
20
21  <metal:content metal:fill-slot="content">
22
23    <div class="workout-content">
24
25      <section class="workout-list">
26
27        <h2 tal:content="context.fullname"></h2>
28
29        <tal:r tal:repeat="workout context.workouts()">
30
31          <article class="workout-resume">
32
33            <h2 class="workout-title">
34              <a href="" tal:content="workout.title"
35                 tal:attributes="href request.resource_url(workout)"></a>
36            </h2>
37
38            <ul class="workout-info">
39              <li>
40                <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c>
41              </li>
42              <li>
43                <tal:c tal:content="workout.duration"></tal:c>
44              </li>
45              <li tal:condition="workout.distance">
46                <tal:c tal:content="workout.rounded_distance"></tal:c> km
47              </li>
48            </ul>
49
50            <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad">
51              <li tal:condition="hr">
52                <span i18n:translate="">HR (bpm)</span>:
53                <tal:c tal:content="hr['min']"></tal:c>
54                <tal:t i18n:translate="">Min.</tal:t>,
55                <tal:c tal:content="hr['avg']"></tal:c>
56                <tal:t i18n:translate="">Avg.</tal:t>,
57                <tal:c tal:content="hr['max']"></tal:c>
58                <tal:t i18n:translate="">Max.</tal:t>
59              </li>
60              <li tal:condition="cad">
61                <span i18n:translate="">Cad</span>:
62                <tal:c tal:content="cad['min']"></tal:c>
63                <tal:t i18n:translate="">Min.</tal:t>,
64                <tal:c tal:content="cad['avg']"></tal:c>
65                <tal:t i18n:translate="">Avg.</tal:t>,
66                <tal:c tal:content="cad['max']"></tal:c>
67                <tal:t i18n:translate="">Max.</tal:t>
68              </li>
69            </ul>
70
71            <div class="workout-intro" tal:content="workout.notes"></div>
72
73            <ul class="workout-options">
74              <li class="owo-edit"><a href="" i18n:translate="" tal:attributes="href request.resource_url(workout, 'edit')"><span>edit</span></a></li>
75              <li class="owo-update"><a href="" i18n:translate="" tal:attributes="href request.resource_url(workout, 'update-from-file')"><span>update with tracking file</span></a></li>
76              <li class="owo-del"><a href="" i18n:translate="" tal:attributes="href request.resource_url(workout, 'delete')"><span>delete</span></a></li>
77            </ul>
78
79          </article>
80
81        </tal:r>
82
83      </section>
84
85      <aside class="workout-aside">
86        <h2>...</h2>
87      </aside>
88
89    </div>
90
91  </metal:content>
92
93</html>
Note: See TracBrowser for help on using the repository browser.