source: OpenWorkouts-current/ow/templates/add_workout.pt @ 42baca4

current
Last change on this file since 42baca4 was 42baca4, checked in by Borja Lopez <borja@…>, 5 years ago

(#39) Do not allow duplicated workouts by default when uploading track files.
We still allow users to add duplicates if they want, by checking a checkbox
we show in the upload workout form when we find a possible duplicate.

  • Property mode set to 100644
File size: 4.0 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="">Upload workout file</tal:t>
12  </metal:head-title>
13
14  <metal:title metal:fill-slot="title">
15    <tal:t i18n:translate="">Upload workout file</tal:t>
16  </metal:title>
17
18  <metal:content metal:fill-slot="content">
19    <div class="upload-workout ow-forms">
20      <a href="" class="back"
21           tal:attributes="href request.resource_url(context)"
22           i18n:translate="">Back</a>
23      <h2 i18n:translate="">Upload workout file</h2>
24        ${form.begin(multipart=True)}
25        ${form.csrf_token()}
26
27      <tal:is_duplicate tal:condition="duplicate is not None">
28        <article class="workout-resume">
29
30          <h2 class="workout-title">
31            <tal:warning i18n:translate="">THIS MAY BE A DUPLICATE OF:</tal:warning>
32            <a href="" tal:content="duplicate.title"
33               tal:attributes="href request.resource_url(duplicate)"></a>
34          </h2>
35
36          <ul class="workout-info">
37            <li>
38              <tal:c tal:content="duplicate.sport"></tal:c>
39            </li>
40            <li>
41              <tal:c tal:content="duplicate.start_in_timezone(context.timezone)"></tal:c>
42            </li>
43            <li>
44              <!--! use the properly formatted duration instead of the timedelta object -->
45              <tal:c tal:content="duplicate._duration"></tal:c>
46            </li>
47            <li tal:condition="duplicate.distance">
48              <tal:c tal:content="duplicate.rounded_distance"></tal:c> km
49            </li>
50            <li tal:condition="duplicate.uphill">
51              +<tal:c tal:content="duplicate.uphill"></tal:c> m
52            </li>
53          </ul>
54
55          <div class="workout-map" tal:condition="duplicate.has_gpx">
56            <a href="" tal:attributes="href request.resource_url(duplicate)">
57              <tal:has-screenshot tal:condition="duplicate.map_screenshot is not None">
58                <img src="" tal:attributes="src request.static_url(duplicate.map_screenshot);
59                          alt duplicate.title; title duplicate.title">
60              </tal:has-screenshot>
61              <tal:has-not-screenshot tal:condition="duplicate.map_screenshot is None">
62                <img src="" tal:attributes="src request.static_url('ow:static/media/img/no_map.gif');
63                          alt duplicate.title; title duplicate.title; class 'js-needs-map'">
64              </tal:has-not-screenshot>
65            </a>
66          </div>
67
68        </article>
69
70        <div>
71      </tal:is_duplicate>
72
73      <fieldset>
74
75        <p>
76          <label for="title" i18n:translate="">Title</label>
77          ${form.errorlist('title')}
78          ${form.text('title')}
79        </p>
80
81        <p>
82          <label for="notes" i18n:translate="">Notes</label>
83          ${form.errorlist('notes')}
84          ${form.textarea('notes', rows=10, cols=50)}
85        </p>
86
87        <p>
88          <label for="tracking_file" i18n:translate="">
89            Workout file (gpx, fit)</label>
90          ${form.errorlist('tracking_file')}
91          ${form.file('tracking_file')}
92        </p>
93
94        <p tal:condition="duplicate is not None">
95          <label for="allow_duplicates" i18n:translate="">Allow duplicated workouts</label>
96          <small i18n:translate="">
97            Mark this checkbox if you want to add to override the mechanism not allowing duplicated workouts
98          </small>
99          <input type="checkbox" name="allow_duplicates">
100        </p>
101
102      </fieldset>
103
104      <tal:with-localizer tal:define="localizer get_localizer(request)">
105        ${form.submit("submit", localizer.translate(_('Save')),  **{'class':"button button-normal"})}
106      </tal:with-localizer>
107
108      ${form.end()}
109    </div>
110
111  </metal:content>
112
113</html>
Note: See TracBrowser for help on using the repository browser.