source: OpenWorkouts-current/ow/templates/dashboard.pt @ 421f05f

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

Show a capture of the workout map, as an image, in the dashboard:

  • Added a view to render the tracking map of a workout full screen
  • Added a small shell script that uses chrome to grabs a screenshot of the full screen map view of a workout, then uses imagemagick convert to crop/resize it and finally saves it in a given location
  • Added a static/maps directory to store maps captures
  • Added static/maps to the boring/ignore file
  • Added a tool in utilities.py to call the shell script that captures the screenshot of the map
  • Added a method to the Workout model, that returns the static path to the workout map capture (valid to use with request.static_url()). If there is no capture yet, call the tool to make one
  • Added code to dashboard.pt to show the capture of the map
  • Added a new parameter to te ow maps js code, allowing us to hide/show the zoom controls of the map when building a new one
  • Property mode set to 100644
File size: 6.7 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        <h3>
30            (<tal:n tal:content="len(workouts)"></tal:n>/<tal:n tal:content="context.num_workouts"></tal:n>) <tal:t i18n:translate="">workouts</tal:t>
31        </h3>
32
33        <tal:no-workouts tal:condition="context.num_workouts == 0">
34            <div class="warning">
35                <p i18n:translate="">You haven't added any workouts yet</p>
36                <p>
37                    <a href="" i18n:translate=""
38                       tal:attributes="href request.resource_url(context, 'add-workout')">
39                        Upload one</a> |
40                    <a href="" i18n:translate=""
41                       tal:attributes="href request.resource_url(context, 'add-workout-manually')">
42                        Add one manually</a>
43                </p>
44            </div>
45        </tal:no-workouts>
46
47        <tal:r tal:repeat="workout workouts">
48
49          <article class="workout-resume">
50
51            <h2 class="workout-title">
52              <a href="" tal:content="workout.title"
53                 tal:attributes="href request.resource_url(workout)"></a>
54            </h2>
55
56            <ul class="workout-info">
57              <li>
58                <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c>
59              </li>
60              <li>
61                <!--! use the properly formatted duration instead of the timedelta object -->
62                <tal:c tal:content="workout._duration"></tal:c>
63              </li>
64              <li tal:condition="workout.distance">
65                <tal:c tal:content="workout.rounded_distance"></tal:c> km
66              </li>
67            </ul>
68
69            <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad">
70              <li tal:condition="hr">
71                <span i18n:translate="">HR (bpm)</span>:
72                <tal:c tal:content="hr['min']"></tal:c>
73                <tal:t i18n:translate="">Min.</tal:t>,
74                <tal:c tal:content="hr['avg']"></tal:c>
75                <tal:t i18n:translate="">Avg.</tal:t>,
76                <tal:c tal:content="hr['max']"></tal:c>
77                <tal:t i18n:translate="">Max.</tal:t>
78              </li>
79              <li tal:condition="cad">
80                <span i18n:translate="">Cad</span>:
81                <tal:c tal:content="cad['min']"></tal:c>
82                <tal:t i18n:translate="">Min.</tal:t>,
83                <tal:c tal:content="cad['avg']"></tal:c>
84                <tal:t i18n:translate="">Avg.</tal:t>,
85                <tal:c tal:content="cad['max']"></tal:c>
86                <tal:t i18n:translate="">Max.</tal:t>
87              </li>
88            </ul>
89
90            <div class="workout-intro" tal:content="workout.notes"></div>
91
92            <div class="workout-map" tal:condition="workout.has_gpx">
93                <a href="" tal:attributes="href request.resource_url(workout)">
94                    <img src="" tal:attributes="src request.static_url(workout.map_screenshot);
95                              alt workout.title; title workout.title">
96                </a>
97            </div>
98
99            <ul class="workout-options">
100              <li class="owo-edit"><a href="" i18n:translate="" tal:attributes="href request.resource_url(workout, 'edit')"><span>edit</span></a></li>
101              <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>
102              <li class="owo-del"><a href="" i18n:translate="" tal:attributes="href request.resource_url(workout, 'delete')"><span>delete</span></a></li>
103            </ul>
104
105          </article>
106
107        </tal:r>
108
109      </section>
110
111      <aside class="workout-aside">
112          <tal:activity_tree tal:condition="context.num_workouts > 0">
113              <ul class="workout-activity-tree" tal:define="tree context.activity_dates_tree">
114                  <tal:years tal:repeat="year sorted(tree.keys(), reverse=True )">
115                      <li tal:define="is_viewing_year year == viewing_year">
116                          <a href="" tal:content="year"
117                             tal:attributes="href request.resource_url(context, query={'year': year});
118                                             class 'js-year viewing-year' if is_viewing_year  else 'js-year'">
119                          </a>
120                          <ul class="workout-activity-tree-year"
121                              tal:attributes="class 'workout-activity-tree-year' if is_viewing_year  else 'workout-activity-tree-year hidden'">
122                              <tal:months tal:repeat="month sorted(tree[year].keys())">
123                                  <li tal:define="is_viewing_month is_viewing_year and month == viewing_month">
124                                      <a href="" tal:content="month_name[month]"
125                                         tal:attributes="href request.resource_url(context, query={'year': year, 'month': month});
126                                                         class 'viewing-month' if is_viewing_month else ''">
127                                      </a>
128                                      <ul class="workout-activity-tree-month">
129                                          <tal:sports tal:repeat="sport sorted(tree[year][month].keys())">
130                                              <li>
131                                                  <a href="#">
132                                                      <tal:sport tal:content="sport"></tal:sport> (<tal:workouts tal:content="tree[year][month][sport]"></tal:workouts>)
133                                                  </a>
134                                              </li>
135                                          </tal:sports>
136                                      </ul>
137                                  </li>
138                              </tal:months>
139                          </ul>
140                      </li>
141                  </tal:years>
142              </ul>
143          </tal:activity_tree>
144      </aside>
145
146    </div>
147
148  </metal:content>
149
150</html>
Note: See TracBrowser for help on using the repository browser.