source: OpenWorkouts-current/ow/templates/workout-map.pt @ 737eb6c

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

Show a capture of the workout map, as an image, in the dashboard:

  • Added a view to render the tracking map of a workout full screen
  • Added a small shell script that uses chrome to grabs a screenshot of the full screen map view of a workout, then uses imagemagick convert to crop/resize it and finally saves it in a given location
  • Added a static/maps directory to store maps captures
  • Added static/maps to the boring/ignore file
  • Added a tool in utilities.py to call the shell script that captures the screenshot of the map
  • Added a method to the Workout model, that returns the static path to the workout map capture (valid to use with request.static_url()). If there is no capture yet, call the tool to make one
  • Added code to dashboard.pt to show the capture of the map
  • Added a new parameter to te ow maps js code, allowing us to hide/show the zoom controls of the map when building a new one
  • Property mode set to 100644
File size: 2.1 KB
Line 
1<!DOCTYPE html>
2
3<html xmlns="http://www.w3.org/1999/xhtml"
4      xml:lang="en"
5      xmlns:tal="http://xml.zope.org/namespaces/tal"
6      xmlns:metal="http://xml.zope.org/namespaces/metal"
7      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
8      i18n:domain="OpenWorkouts"
9      tal:attributes="lang request.locale_name">
10
11  <head>
12
13    <meta charset="utf-8">
14    <meta http-equiv="X-UA-Compatible" content="IE=edge">
15    <meta name="viewport" content="width=device-width, initial-scale=1.0">
16    <meta name="description"
17          content="OpenWorkouts - tracking your workouts openly">
18    <meta name="author" content="The OpenWorkouts Project">
19    <title>OpenWorkouts - tracking your workouts openly</title>
20
21    <link rel="stylesheet"
22          href="${request.static_url('ow:static/css/main.css')}" />
23    <link rel="stylesheet"
24          href="${request.static_url('ow:static/css/openworkouts.css')}" />
25    <link rel="stylesheet" tal:condition="context.has_gpx"
26          href="${request.static_url('ow:static/components/Leaflet/leaflet.css')}" />
27
28    <style>
29     html, body, #full-map {
30         height:100%;
31         width:100%;
32         padding:0px;
33         margin:0px;
34     }
35    </style>
36
37  </head>
38
39  <body class="full-map">
40    <!--! Track map -->
41    <div id="full-map" tal:condition="context.has_gpx"></div>
42
43    <script src="${request.static_url('ow:static/components/Leaflet/leaflet.js')}"
44            tal:condition="context.has_gpx"></script>
45
46    <script src="${request.static_url('ow:static/components/leaflet-gpx/gpx.js')}"
47            tal:condition="context.has_gpx"></script>
48
49    <script src="${request.static_url('ow:static/js/ow.js')}"
50            tal:condition="context.has_gpx"></script>
51
52    <script type="text/javascript" tal:condition="context.has_gpx">
53     var workout_map = owjs.map({
54         map_id: 'full-map',
55         latitude: ${start_point['latitude']},
56         longitude: ${start_point['longitude']},
57         zoom: 11,
58         gpx_url: '${request.resource_url(context, 'gpx')}',
59         elevation: false,
60         zoom_control: false
61     });
62     workout_map.render();
63
64    </script>
65  </body>
66
67</html>
Note: See TracBrowser for help on using the repository browser.