[5ec3a0b] | 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 | |
---|
[2d91474] | 27 | <h3> |
---|
[b437d1e] | 28 | <tal:d tal:content="month_name[viewing_month] + ' ' + str(viewing_year)"></tal:d> - |
---|
| 29 | <tal:n tal:content="len(workouts)"></tal:n> |
---|
| 30 | <tal:t i18n:translate="">Workouts</tal:t> |
---|
[2d91474] | 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"> |
---|
[5ec3a0b] | 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> |
---|
[31adfa5] | 58 | <tal:c tal:content="workout.start_in_timezone(context.timezone)"></tal:c> |
---|
[5ec3a0b] | 59 | </li> |
---|
| 60 | <li> |
---|
[64e8299] | 61 | <!--! use the properly formatted duration instead of the timedelta object --> |
---|
| 62 | <tal:c tal:content="workout._duration"></tal:c> |
---|
[5ec3a0b] | 63 | </li> |
---|
| 64 | <li tal:condition="workout.distance"> |
---|
| 65 | <tal:c tal:content="workout.rounded_distance"></tal:c> km |
---|
| 66 | </li> |
---|
[4985618] | 67 | <li tal:condition="workout.uphill"> |
---|
| 68 | +<tal:c tal:content="workout.uphill"></tal:c> m |
---|
| 69 | </li> |
---|
[5ec3a0b] | 70 | </ul> |
---|
| 71 | |
---|
| 72 | <ul class="workout-info" tal:define="hr workout.hr; cad workout.cad"> |
---|
| 73 | <li tal:condition="hr"> |
---|
| 74 | <span i18n:translate="">HR (bpm)</span>: |
---|
| 75 | <tal:c tal:content="hr['avg']"></tal:c> |
---|
| 76 | <tal:t i18n:translate="">Avg.</tal:t>, |
---|
| 77 | <tal:c tal:content="hr['max']"></tal:c> |
---|
| 78 | <tal:t i18n:translate="">Max.</tal:t> |
---|
| 79 | </li> |
---|
| 80 | <li tal:condition="cad"> |
---|
| 81 | <span i18n:translate="">Cad</span>: |
---|
| 82 | <tal:c tal:content="cad['avg']"></tal:c> |
---|
| 83 | <tal:t i18n:translate="">Avg.</tal:t>, |
---|
| 84 | <tal:c tal:content="cad['max']"></tal:c> |
---|
| 85 | <tal:t i18n:translate="">Max.</tal:t> |
---|
| 86 | </li> |
---|
| 87 | </ul> |
---|
| 88 | |
---|
| 89 | <div class="workout-intro" tal:content="workout.notes"></div> |
---|
| 90 | |
---|
[d1c4782] | 91 | <div class="workout-map" tal:condition="workout.has_gpx"> |
---|
| 92 | <a href="" tal:attributes="href request.resource_url(workout)"> |
---|
| 93 | <img src="" tal:attributes="src request.static_url(workout.map_screenshot); |
---|
| 94 | alt workout.title; title workout.title"> |
---|
| 95 | </a> |
---|
| 96 | </div> |
---|
| 97 | |
---|
[5ec3a0b] | 98 | </article> |
---|
| 99 | |
---|
| 100 | </tal:r> |
---|
| 101 | |
---|
| 102 | </section> |
---|
| 103 | |
---|
| 104 | <aside class="workout-aside"> |
---|
[1fe89ea] | 105 | <div class="aside-profile"> |
---|
| 106 | <tal:c tal:condition="getattr(context, 'picture', None)"> |
---|
[aa2130b] | 107 | <a href="" tal:attributes="href request.resource_url(context, 'profile')"> |
---|
| 108 | <img tal:attributes="src request.resource_path(context, 'picture')" |
---|
| 109 | width="450" /> |
---|
| 110 | </a> |
---|
[1fe89ea] | 111 | </tal:c> |
---|
[aa2130b] | 112 | <h2> |
---|
| 113 | <a href="" tal:attributes="href request.resource_url(context, 'profile')" |
---|
| 114 | tal:content="context.fullname"> |
---|
| 115 | </a> |
---|
| 116 | </h2> |
---|
[1fe89ea] | 117 | <ul> |
---|
| 118 | <Li> |
---|
| 119 | <tal:n tal:content="context.num_workouts"></tal:n> <tal:t i18n:translate="">workouts</tal:t> |
---|
| 120 | </Li> |
---|
| 121 | </ul> |
---|
| 122 | </div> |
---|
| 123 | <div class="week-stats js-week-stats"> |
---|
| 124 | <h3><tal:t i18n:translate="">This week</tal:t></h3> |
---|
| 125 | <p tal:define="totals context.week_totals"> |
---|
| 126 | <span class="week-stats-distance"> |
---|
| 127 | <tal:d tal:content="round(totals['distance'])"></tal:d> |
---|
| 128 | <tal:t i18n:translate="">kms</tal:t> |
---|
| 129 | </span> |
---|
| 130 | <span class="week-stats-time"> |
---|
| 131 | <tal:hms tal:define="hms timedelta_to_hms(totals['time'])"> |
---|
| 132 | <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h> |
---|
| 133 | <tal:t i18n:translate="">hours</tal:t>, |
---|
| 134 | <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h> |
---|
| 135 | <tal:t i18n:translate="">min.</tal:t> |
---|
| 136 | </tal:hms> |
---|
| 137 | </span> |
---|
| 138 | </p> |
---|
| 139 | <div class="svg-cotent"> |
---|
| 140 | <svg width="300" height="200" viewBox="0 0 300 200"></svg> |
---|
| 141 | </div> |
---|
| 142 | </div> |
---|
| 143 | |
---|
[2d91474] | 144 | <tal:activity_tree tal:condition="context.num_workouts > 0"> |
---|
| 145 | <ul class="workout-activity-tree" tal:define="tree context.activity_dates_tree"> |
---|
| 146 | <tal:years tal:repeat="year sorted(tree.keys(), reverse=True )"> |
---|
| 147 | <li tal:define="is_viewing_year year == viewing_year"> |
---|
| 148 | <a href="" tal:content="year" |
---|
| 149 | tal:attributes="href request.resource_url(context, query={'year': year}); |
---|
| 150 | class 'js-year viewing-year' if is_viewing_year else 'js-year'"> |
---|
| 151 | </a> |
---|
[1fe89ea] | 152 | <ul tal:define="stats context.stats(year)" tal:attributes="class 'workout-activity-summary' if is_viewing_year else 'workout-activity-summary hidden'"> |
---|
| 153 | <li> |
---|
| 154 | <span i18n:translate="">Workouts:</span> |
---|
| 155 | <span tal:content="stats['workouts']"></span> |
---|
| 156 | </li> |
---|
| 157 | <li> |
---|
| 158 | <span i18n:translate="">Distance:</span> |
---|
| 159 | <span> <tal:kms tal:content="round(stats['distance'])"></tal:kms> km</span> |
---|
| 160 | </li> |
---|
| 161 | <li> |
---|
| 162 | <span i18n:translate="">Time:</span> |
---|
| 163 | <tal:hms tal:define="hms timedelta_to_hms(stats['time'])"> |
---|
| 164 | <span> |
---|
| 165 | <tal:h tal:content="str(hms[0]).zfill(2)"></tal:h> |
---|
| 166 | <tal:t i18n:translate="">hours</tal:t>, |
---|
| 167 | <tal:h tal:content="str(hms[1]).zfill(2)"></tal:h> |
---|
| 168 | <tal:t i18n:translate="">min.</tal:t> |
---|
| 169 | </span> |
---|
| 170 | </tal:hms> |
---|
| 171 | </li> |
---|
| 172 | <li> |
---|
| 173 | <span i18n:translate="">Elevation:</span> |
---|
| 174 | <span> <tal:m tal:content="stats['elevation']"></tal:m> m</span> |
---|
| 175 | </li> |
---|
| 176 | </ul> |
---|
[2d91474] | 177 | <ul class="workout-activity-tree-year" |
---|
| 178 | tal:attributes="class 'workout-activity-tree-year' if is_viewing_year else 'workout-activity-tree-year hidden'"> |
---|
| 179 | <tal:months tal:repeat="month sorted(tree[year].keys())"> |
---|
| 180 | <li tal:define="is_viewing_month is_viewing_year and month == viewing_month"> |
---|
[5cbc4a0] | 181 | <a href="" |
---|
[2d91474] | 182 | tal:attributes="href request.resource_url(context, query={'year': year, 'month': month}); |
---|
| 183 | class 'viewing-month' if is_viewing_month else ''"> |
---|
[5cbc4a0] | 184 | <span tal:content="month_name[month]"></span> |
---|
| 185 | <span tal:content="sum([tree[year][month][sport] for sport in tree[year][month]])"></span> |
---|
[2d91474] | 186 | </a> |
---|
| 187 | </li> |
---|
| 188 | </tal:months> |
---|
| 189 | </ul> |
---|
| 190 | </li> |
---|
| 191 | </tal:years> |
---|
| 192 | </ul> |
---|
| 193 | </tal:activity_tree> |
---|
[5bdfbfb] | 194 | |
---|
[5ec3a0b] | 195 | </aside> |
---|
| 196 | |
---|
| 197 | </div> |
---|
| 198 | |
---|
| 199 | </metal:content> |
---|
| 200 | |
---|
[5bdfbfb] | 201 | <metal:body-js metal:fill-slot="body-js"> |
---|
| 202 | <script src="${request.static_url('ow:static/components/d3/d3.min.js')}"></script> |
---|
| 203 | <script src="${request.static_url('ow:static/js/ow.js')}"></script> |
---|
| 204 | |
---|
| 205 | <script type="text/javascript"> |
---|
| 206 | var week_chart = owjs.week_chart({ |
---|
[4bab6c1] | 207 | chart_selector: 'div.js-week-stats svg', |
---|
[5bdfbfb] | 208 | url: "${request.resource_url(context, 'week')}", |
---|
| 209 | current_day_name: "${current_day_name}" |
---|
| 210 | }); |
---|
| 211 | week_chart.render(); |
---|
| 212 | </script> |
---|
| 213 | |
---|
| 214 | </metal:body-js> |
---|
| 215 | |
---|
[5ec3a0b] | 216 | </html> |
---|