source: OpenWorkouts-current/ow/templates/dashboard.pt

current
Last change on this file was 035792a, checked in by Borja Lopez <borja@…>, 5 years ago

Fixed typo, s/cotent/content

  • Property mode set to 100644
File size: 9.5 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        <h3 tal:condition="viewing_month is not None"
28            tal:define="localizer get_localizer(request)">
29          <tal:d tal:content="localizer.translate(month_name[viewing_month]) + ' ' + str(viewing_year)"></tal:d> -
30          <tal:n tal:content="len(workouts)"></tal:n>
31          <tal:t i18n:translate="">Workouts</tal:t>
32        </h3>
33
34        <tal:no-workouts tal:condition="context.num_workouts == 0">
35            <div class="warning">
36                <p i18n:translate="">You haven't added any workouts yet</p>
37                <p>
38                    <a href="" i18n:translate=""
39                       tal:attributes="href request.resource_url(context, 'add-workout')">
40                        Upload one</a> |
41                    <a href="" i18n:translate=""
42                       tal:attributes="href request.resource_url(context, 'add-workout-manually')">
43                        Add one manually</a>
44                </p>
45            </div>
46        </tal:no-workouts>
47
48        <tal:r tal:repeat="workout workouts">
49
50          <article class="workout-resume">
51
52            <h2 class="workout-title">
53              <a href="" tal:content="workout.title"
54                 tal:attributes="href request.resource_url(workout)"></a>
55            </h2>
56
57            <ul class="workout-info">
58              <li>
59                <tal:c tal:content="workout.sport"></tal:c>
60              </li>
61              <li>
62                <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c>
63              </li>
64              <li>
65                <!--! use the properly formatted duration instead of the timedelta object -->
66                <tal:c tal:content="workout._duration"></tal:c>
67              </li>
68              <li tal:condition="workout.distance">
69                <tal:c tal:content="workout.rounded_distance"></tal:c> km
70              </li>
71              <li tal:condition="workout.uphill">
72                +<tal:c tal:content="workout.uphill"></tal:c> m
73              </li>
74            </ul>
75
76            <div class="workout-intro">
77              <p tal:repeat="paragraph workout.trimmed_notes.split('\n')"
78                 tal:content="paragraph"></p>
79            </div>
80
81            <div class="workout-map" tal:condition="workout.has_gpx">
82              <a href="" tal:attributes="href request.resource_url(workout)">
83                <tal:has-screenshot tal:condition="workout.map_screenshot is not None">
84                  <img src="" tal:attributes="src request.static_url(workout.map_screenshot);
85                            alt workout.title; title workout.title">
86                </tal:has-screenshot>
87                <tal:has-not-screenshot tal:condition="workout.map_screenshot is None">
88                  <img src="" tal:attributes="src request.static_url('ow:static/media/img/no_map.gif');
89                            alt workout.title; title workout.title; class 'js-needs-map'">
90                </tal:has-not-screenshot>
91              </a>
92            </div>
93
94          </article>
95
96        </tal:r>
97
98      </section>
99
100      <aside class="workout-aside">
101        <div class="aside-profile">
102          <tal:c tal:condition="getattr(context, 'picture', None)">
103            <a href="" tal:attributes="href request.resource_url(context, 'profile')">
104              <img tal:attributes="src request.resource_path(context, 'picture', query={'size': 200})"
105                   width="450" />
106            </a>
107          </tal:c>
108          <h2>
109            <a href="" tal:attributes="href request.resource_url(context, 'profile')"
110               tal:content="context.fullname">
111            </a>
112          </h2>
113          <ul>
114            <li>
115              <tal:n tal:content="context.num_workouts"></tal:n> <tal:t i18n:translate="">workouts</tal:t>
116            </li>
117          </ul>
118        </div>
119          <div class="week-stats js-week-stats">
120            <h3><tal:t i18n:translate="">This week</tal:t></h3>
121            <p tal:define="totals context.week_totals">
122              <span class="week-stats-distance">
123                <tal:d tal:content="round(totals['distance'])"></tal:d>
124                <tal:t i18n:translate="">km</tal:t> |
125              </span>
126              <span class="week-stats-time">
127                <tal:hms tal:define="hms timedelta_to_hms(totals['time'])">
128                  <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
129                  <tal:t i18n:translate="">hours</tal:t>,
130                  <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
131                  <tal:t i18n:translate="">min.</tal:t>
132                </tal:hms>
133              </span>
134            </p>
135            <div class="svg-content">
136              <svg width="300" height="200" viewBox="0 0 300 200"></svg>
137            </div>
138          </div>
139
140          <tal:activity_tree tal:condition="context.num_workouts > 0">
141              <ul class="workout-activity-tree" tal:define="tree context.activity_dates_tree">
142                  <tal:years tal:repeat="year sorted(tree.keys(), reverse=True )">
143                      <li tal:define="is_viewing_year year == viewing_year">
144                          <a href="" tal:content="year"
145                             tal:attributes="href request.resource_url(context, query={'year': year});
146                                             class 'js-year viewing-year' if is_viewing_year  else 'js-year'">
147                          </a>
148                          <ul tal:define="stats context.stats(year)" tal:attributes="class 'workout-activity-summary' if is_viewing_year  else 'workout-activity-summary hidden'">
149                            <li>
150                              <span i18n:translate="">Workouts:</span>
151                              <span tal:content="stats['workouts']"></span>
152                            </li>
153                            <li>
154                              <span i18n:translate="">Distance:</span>
155                              <span> <tal:km tal:content="round(stats['distance'])"></tal:km> km</span>
156                            </li>
157                            <li>
158                              <span i18n:translate="">Time:</span>
159                              <tal:hms tal:define="hms timedelta_to_hms(stats['time'])">
160                                <span>
161                                  <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h>
162                                  <tal:t i18n:translate="">hours</tal:t>,
163                                  <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h>
164                                  <tal:t i18n:translate="">min.</tal:t>
165                                </span>
166                              </tal:hms>
167                            </li>
168                            <li>
169                              <span i18n:translate="">Elevation:</span>
170                              <span> <tal:m tal:content="stats['elevation']"></tal:m> m</span>
171                            </li>
172                          </ul>
173                          <ul class="workout-activity-tree-year"
174                              tal:attributes="class 'workout-activity-tree-year' if is_viewing_year  else 'workout-activity-tree-year hidden'">
175                              <tal:months tal:repeat="month sorted(tree[year].keys())">
176                                  <li tal:define="is_viewing_month is_viewing_year and month == viewing_month">
177                                    <a href=""
178                                       tal:attributes="href request.resource_url(context, query={'year': year, 'month': month});
179                                             class 'viewing-month' if is_viewing_month else ''"
180                                       tal:define="localizer get_localizer(request)">
181                                      <span tal:content="localizer.translate(month_name[month])"></span>
182                                      <span tal:content="sum([tree[year][month][sport] for sport in tree[year][month]])"></span>
183                                    </a>
184                                  </li>
185                              </tal:months>
186                          </ul>
187                      </li>
188                  </tal:years>
189              </ul>
190          </tal:activity_tree>
191
192      </aside>
193
194    </div>
195
196  </metal:content>
197
198  <metal:body-js metal:fill-slot="body-js">
199    <script src="${request.static_url('ow:static/components/d3/d3.min.js')}"></script>
200    <script src="${request.static_url('ow:static/js/ow.js')}"></script>
201
202    <script type="text/javascript">
203
204     var map_shots = owjs.map_shots({
205         img_selector: 'img.js-needs-map',
206     })
207     map_shots.run();
208
209     var week_chart = owjs.week_chart({
210         chart_selector: 'div.js-week-stats svg',
211         url: "${request.resource_url(context, 'week')}",
212         current_day_name: "${current_day_name}"
213     });
214     week_chart.render();
215    </script>
216
217  </metal:body-js>
218
219</html>
Note: See TracBrowser for help on using the repository browser.