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