source: OpenWorkouts-current/ow/templates/workout.pt @ a0085a2

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

Added missing leaflet elevation third-party js library.

We have been using this for elevation charts in the workout details page.

  • Property mode set to 100644
File size: 6.2 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="">Workout details</tal:t>:
12    <tal:c tal:content="context.title"></tal:c>
13  </metal:head-title>
14
15  <metal:css metal:fill-slot="css">
16    <link rel="stylesheet" tal:condition="context.has_gpx"
17          href="${request.static_url('ow:static/components/Leaflet/leaflet.css')}" />
18    <link rel="stylesheet" tal:condition="context.has_gpx"
19          href="${request.static_url('ow:static/components/Leaflet.Elevation/dist/leaflet.elevation-0.0.4.css')}" />
20
21    <!--!
22    <link rel="stylesheet" tal:condition="context.has_gpx"
23          href="${request.static_url('ow:static/leaflet-elevation/leaflet.elevation.css')}" />
24
25    <link rel="stylesheet" tal:condition="context.has_gpx"
26          href="${request.static_url('ow:static/leaflet-openworkouts/leaflet.openworkouts.css')}" />
27    -->
28
29  </metal:css>
30
31  <metal:title metal:fill-slot="title">
32    <tal:t i18n:translate="">Workout details</tal:t>
33  </metal:title>
34
35  <metal:content metal:fill-slot="content">
36
37    <!--! Track map -->
38    <div id="map" tal:condition="context.has_gpx"></div>
39
40    <!--! Additional map controls -->
41
42    <div id="ow-analysis">
43
44      <!--!
45          FIXME: the list of available charts should come from the workout
46          details, based on which data this workout has
47        -->
48      <!--! All those ids are needed for the leaflet openworkouts plugin -->
49      <tal:r tal:repeat="chart ['elevation', 'heartrate', 'cadence', 'temperature']">
50        <div id="ow-" tal:attributes="id 'ow-' + chart">
51          <div class="ow-average" id=""
52               tal:attributes="id 'ow-' + chart + '-average'"></div>
53          <div class="ow-chart" id=""
54               tal:attributes="id 'ow-' + chart + '-chart'"></div>
55          <div class="ow-current" id=""
56               tal:attributes="id 'ow-' + chart + '-current'"></div>
57        </div>
58      </tal:r>
59
60    </div>
61
62    <div id="workout">
63      <h3 tal:content="context.title"></h3>
64      <h4>
65        <a href="" i18n:translate=""
66           tal:attributes="href request.resource_url(context, 'edit')">
67          (edit workout)
68        </a> |
69        <a href="" i18n:translate=""
70           tal:attributes="href request.resource_url(context, 'update-from-file')">
71          (update with tracking file)
72        </a> |
73        <a href="" i18n:translate=""
74           tal:attributes="href request.resource_url(context, 'delete')">
75          (delete)
76        </a>
77      </h4>
78
79      <ul id="" tal:attributes="id 'workout-' + context.workout_id + '-details'"
80          tal:define="hr context.hr; cad context.cad">
81        <li>
82          <tal:t i18n:translate="">Start:</tal:t>
83          <tal:c tal:content="context.start"></tal:c>
84        </li>
85        <li>
86          <tal:t i18n:translate="">End:</tal:t>
87          <tal:c tal:content="context.end"></tal:c>
88        </li>
89        <li>
90          <tal:t i18n:translate="">Duration:</tal:t>
91          <tal:c tal:content="context.duration"></tal:c>
92        </li>
93        <li tal:condition="context.distance">
94          <tal:t i18n:translate="">Distance:</tal:t>
95          <tal:c tal:content="context.rounded_distance"></tal:c> km
96        </li>
97        <li tal:condition="hr">
98          <tal:t i18n:translate="">Heart Rate:</tal:t>
99          <tal:t i18n:translate="">Min.</tal:t>
100          <tal:c tal:content="hr['min']"></tal:c> bpm |
101          <tal:t i18n:translate="">Avg.</tal:t>
102          <tal:c tal:content="hr['avg']"></tal:c> bpm |
103          <tal:t i18n:translate="">Max.</tal:t>
104          <tal:c tal:content="hr['max']"></tal:c> bpm
105        </li>
106        <li tal:condition="cad">
107          <tal:t i18n:translate="">Cadence:</tal:t>
108          <tal:t i18n:translate="">Min.</tal:t>
109          <tal:c tal:content="cad['min']"></tal:c> |
110          <tal:t i18n:translate="">Avg.</tal:t>
111          <tal:c tal:content="cad['avg']"></tal:c> |
112          <tal:t i18n:translate="">Max.</tal:t>
113          <tal:c tal:content="cad['max']"></tal:c>
114        </li>
115      </ul>
116      <div id="" tal:content="context.notes"
117           tal:attributes="id 'workout-' + context.workout_id + '-notes'">
118      </div>
119    </div>
120  </metal:content>
121
122  <metal:body-js metal:fill-slot="body-js">
123
124    <!--
125    <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
126    <script src="${request.static_url('ow:static/d3/d3.min.js')}"
127            tal:condition="context.has_gpx"></script>
128    -->
129
130    <script src="${request.static_url('ow:static/components/Leaflet/leaflet.js')}"
131            tal:condition="context.has_gpx"></script>
132
133    <script src="${request.static_url('ow:static/components/leaflet-gpx/gpx.js')}"
134            tal:condition="context.has_gpx"></script>
135
136    <script src="${request.static_url('ow:static/components/Leaflet.Elevation/dist/leaflet.elevation-0.0.4.min.js')}"
137            tal:condition="context.has_gpx"></script>
138
139    <!--!
140    <script src="${request.static_url('ow:static/leaflet-elevation/leaflet.elevation.min.js')}"
141            tal:condition="context.has_gpx"></script>
142    <script src="${request.static_url('ow:static/leaflet-openworkouts/leaflet.openworkouts.src.js')}"
143            tal:condition="context.has_gpx"></script>
144    <script src="${request.static_url('ow:static/js/ow.js')}"
145            tal:condition="context.has_gpx"></script>
146    -->
147
148    <script type="text/javascript" tal:condition="context.has_gpx">
149      var workout_map = owjs.map({
150          latitude: ${start_point['latitude']},
151          longitude: ${start_point['longitude']},
152          zoom: 11,
153          gpx_url: '${request.resource_url(context, 'gpx')}',
154          start_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-start.png')}',
155          end_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-end.png')}',
156          shadow: '${request.static_url('ow:static/leaflet-gpx/pin-shadow.png')}',
157      });
158      workout_map.render()
159    </script>
160  </metal:body-js>
161
162</html>
Note: See TracBrowser for help on using the repository browser.