source: OpenWorkouts-current/ow/templates/delete_workout.pt @ fc01180

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

(#14) Timezones support:

  • Added pytz as a new dependency, please install it in your existing envs:

pip install pytz

  • Added a timezone attribute to users, to store in which timezone they are, defaults to 'UTC'. Ensure any users you could have in your database have such attribute. You can add it in pshell:

for user in root.users:

user.timezone = 'UTC'

request.tm.commit()

  • Modified schemas/templates/views to let users choose their timezone based on a list of "common" timezones provided by pytz
  • Added two methods to the Workout model so we can get the start and end dates formatted in the appropiate timezone (all datetime objects are stored in UTC)
  • Modified the templates where we show workout dates and times so the new timezone-formatting methods are used.
  • Property mode set to 100644
File size: 2.4 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="">Delete workout</tal:t> -
12    <tal:w tal:content="context.title"></tal:w>
13  </metal:head-title>
14
15  <metal:title metal:fill-slot="title">
16    <tal:t i18n:translate="">Delete workout</tal:t> -
17    <tal:w tal:content="context.title"></tal:w>
18  </metal:title>
19
20  <metal:content metal:fill-slot="content">
21    <div id="delete_workout">
22      <form action="" method="POST">
23        <input id="_csrf" name="_csrf" type="hidden" value=""
24               tal:attributes="value request.session.get_csrf_token()" />
25        <input id="delete" name="delete" type="hidden" value="yes" />
26
27        <div id="workout"
28             tal:define="timezone request.root[request.authenticated_userid].timezone">
29        <h3 tal:content="context.title"></h3>
30        <ul id="" tal:attributes="id 'workout-' + context.workout_id + '-details'">
31          <li>
32            <tal:t i18n:translate="">Start:</tal:t>
33            <tal:c tal:content="context.start_in_timezone(timezone)"></tal:c>
34          </li>
35          <li>
36            <tal:t i18n:translate="">End:</tal:t>
37            <tal:c tal:content="context.end_in_timezone(timezone)"></tal:c>
38          </li>
39          <li>
40            <tal:t i18n:translate="">Distance:</tal:t>
41            <tal:c tal:content="context.distance"></tal:c>
42          </li>
43          <li>
44            <tal:t i18n:translate="">Average Heart Rate:</tal:t>
45            <tal:c tal:content="context.hr_avg"></tal:c>
46          </li>
47          <li>
48            <tal:t i18n:translate="">Maximum Heart Rate:</tal:t>
49            <tal:c tal:content="context.hr_max"></tal:c>
50          </li>
51        </ul>
52        <div id="" tal:content="context.notes"
53             tal:attributes="id 'workout-' + context.workout_id + '-notes'">
54        </div>
55      </div>
56
57      <div>
58        Are you sure you want to delete this workout?
59      </div>
60
61      <input type="submit" name="submit" value="Yes, delete" />
62      <a href="" tal:attributes="href request.resource_url(context)"
63         i18n:translate="">Cancel</a>
64      </form>
65    </div>
66
67  </metal:content>
68
69</html>
Note: See TracBrowser for help on using the repository browser.