summaryrefslogtreecommitdiff
path: root/templates
diff options
context:
space:
mode:
Diffstat (limited to 'templates')
-rw-r--r--templates/journey.html.ep116
-rw-r--r--templates/polyline.gpx.ep20
2 files changed, 91 insertions, 45 deletions
diff --git a/templates/journey.html.ep b/templates/journey.html.ep
index f9c78ec..95764eb 100644
--- a/templates/journey.html.ep
+++ b/templates/journey.html.ep
@@ -317,47 +317,14 @@
</div>
</div>
% if (not stash('readonly')) {
- % if (stash('with_share')) {
- <div class="row">
- <div class="col s12 m6 l6">
- </div>
- <div class="col s12 m6 l6 center-align">
- <a class="btn waves-effect waves-light action-share"
- % if (stash('journey_visibility') eq 'public') {
- data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>"
- % }
- % else {
- data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>?token=<%= $journey->{from_eva} %>-<%= $journey->{checkin_ts} % 337 %>-<%= int($journey->{sched_dep_ts}) %>"
- % }
- data-text="<%= stash('share_text') %>"
- >
- <i class="material-icons left" aria-hidden="true">share</i>
- %= L('journey.share')
- </a>
- </div>
- </div>
- % }
<div class="row">
- <div class="col s12 m6 l6">
- </div>
- <div class="col s12 m6 l6 center-align">
+ <div class="col s12 m6 l4 center-align">
<a class="btn waves-effect waves-light" href="<%= url_for('journey', id => $journey->{id}, format => 'json' ) %>">
<i class="material-icons left" aria-hidden="true">file_download</i>
%= L('journey.export')
</a>
</div>
- </div>
- <div class="row hide-on-small-only">
- <div class="col s12 m6 l6 center-align">
- <a class="waves-effect waves-light red btn action-delete"
- data-id="<%= $journey->{id} %>"
- data-checkin="<%= $journey->{checkin}->epoch %>"
- data-checkout="<%= $journey->{checkout}->epoch %>">
- <i class="material-icons left">delete_forever</i>
- %= L('journey.delete')
- </a>
- </div>
- <div class="col s12 m6 l6 center-align">
+ <div class="col s12 m6 l4 center-align">
%= form_for '/journey/edit' => (method => 'POST') => begin
%= hidden_field 'journey_id' => param('journey_id')
<button class="btn waves-effect waves-light" type="submit" name="action" value="edit">
@@ -366,18 +333,77 @@
</button>
%= end
</div>
+ <div class="col s12 m6 l4 center-align">
+ % if (stash('with_share')) {
+ <a class="btn waves-effect waves-light action-share"
+ % if (stash('journey_visibility') eq 'public') {
+ data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>"
+ % }
+ % else {
+ data-url="<%= url_for('public_journey', name => current_user()->{name}, id => $journey->{id} )->to_abs->scheme('https'); %>?token=<%= $journey->{from_eva} %>-<%= $journey->{checkin_ts} % 337 %>-<%= int($journey->{sched_dep_ts}) %>"
+ % }
+ data-text="<%= stash('share_text') %>"
+ >
+ <i class="material-icons left" aria-hidden="true">share</i>
+ %= L('journey.share')
+ </a>
+ % }
+ </div>
</div>
- <div class="row hide-on-med-and-up">
- <div class="col s12 m6 l6 center-align">
- %= form_for '/journey/edit' => (method => 'POST') => begin
- %= hidden_field 'journey_id' => param('journey_id')
- <button class="btn waves-effect waves-light" type="submit" name="action" value="edit">
- <i class="material-icons left" aria-hidden="true">edit</i>
- %= L('journey.edit')
- </button>
- %= end
+ % if ($journey->{polyline} or $journey->{km_route} > 0.1) {
+ <h2><%= L('journey.map-data') %>
+ % if ($journey->{edited} & 0x0040) {
+ ∗
+ % }
+ </h2>
+ <div class="row">
+ <div class="col s12 m6 l6 center-align">
+ <a class="btn waves-effect waves-light" href="<%= url_for('polyline_download', id => $journey->{id}, format => 'json' ) %>">
+ <i class="material-icons left" aria-label="<%= L('journey.map.download') %>">file_download</i>
+ JSON
+ </a>
+ </div>
+ <div class="col s12 m6 l6 center-align">
+ <a class="btn waves-effect waves-light" href="<%= url_for('polyline_download', id => $journey->{id}, format => 'gpx' ) %>">
+ <i class="material-icons left" aria-label="<%= L('journey.map.download') %>">file_download</i>
+ GPX
+ </a>
+ </div>
+ </div>
+ <div class="row">
+ <div class="col s12">
+ %= L('journey.map.info.download')
+ %= L('journey.map.info.upload')
+ </div>
</div>
- <div class="col s12 m6 l6 center-align" style="margin-top: 1em;">
+ %= form_for '/polyline/set' => (method => 'post', enctype => 'multipart/form-data') => begin
+ %= csrf_field
+ %= hidden_field id => $journey->{id}
+ <div class="row">
+ <div class="col s12">
+ <div class="file-field input-field">
+ <div class="btn">
+ <span><i class="material-icons left" aria-label="<%= L('journey.map.upload') %>">file_upload</i> GPX</span>
+ <input type="file">
+ </div>
+ <div class="file-path-wrapper">
+ <input class="file-path validate" type="text" name="file">
+ </div>
+ %= file_field 'file'
+ </div>
+ </div>
+ <div class="col s12 m6 center-align">
+ %= submit_button L('journey.map.upload-full'), class => 'waves-effect waves-light btn', name => 'upload-full'
+ </div>
+ <div class="col s12 m6 center-align">
+ %= submit_button L('journey.map.upload-partial'), class => 'waves-effect waves-light btn', name => 'upload-partial'
+ </div>
+ </div>
+ %= end
+ % }
+ <h2><%= L('journey.danger') %></h2>
+ <div class="row">
+ <div class="col s12 m12 l12 center-align" style="margin-top: 1em;">
<a class="waves-effect waves-light red btn action-delete"
data-id="<%= $journey->{id} %>"
data-checkin="<%= $journey->{checkin}->epoch %>"
diff --git a/templates/polyline.gpx.ep b/templates/polyline.gpx.ep
new file mode 100644
index 0000000..a243926
--- /dev/null
+++ b/templates/polyline.gpx.ep
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gpx
+ xmlns="http://www.topografix.com/GPX/1/1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"
+ version="1.1"
+ creator="travelynx <%= $version %>">
+ <trk>
+ <name><%= $name %></name>
+ <trkseg>
+ % for my $entry (@{$polyline // []}) {
+ <trkpt lon="<%= $entry->[0] %>" lat="<%= $entry->[1] %>">
+ % if ($entry->[2]) {
+ <name><%= $entry->[2] %></name>
+ % }
+ </trkpt>
+ % }
+ </trkseg>
+ </trk>
+</gpx>