From 1f6bdfb4f3ce838c5e63673545354d5004c0d010 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sun, 25 Jun 2017 19:10:27 +0200 Subject: [PATCH] refs #30 add metadata field 'track name' loaded from metadata>name; make metadata hidden by default --- css/gpxedit.css | 25 +++++++++++++------------ js/gpxedit.js | 17 +++++++++++++++++ l10n/fr.json | 2 ++ templates/gpxcontent.php | 21 ++++++++++++--------- 4 files changed, 44 insertions(+), 21 deletions(-) diff --git a/css/gpxedit.css b/css/gpxedit.css index 6d29567..b897822 100644 --- a/css/gpxedit.css +++ b/css/gpxedit.css @@ -792,27 +792,17 @@ h2.popupTitle{ color: red; } -#saveButton { +#saveButton, #saveName { width: 100%; } #loadButton i, #loadFolderButton i{ color: blue; } -#saveNameLabel, #savePathLabel{ - float:left; -} -#saveName, #savePath{ - width: 100%; - float: right; -} -#savePath{ - background-color: #C9C9C9; -} .selectimg{ background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90); background-size: 20px 20px; } -#linktextinput, #linkurlinput { +#linktextinput, #linkurlinput, #tracknameinput { width: 100%; } #desctext{ @@ -904,3 +894,14 @@ div#ho button { .customtiletitle { cursor: pointer; } +#metadata { + display: none; +} +#metadatalabel { + width: 100%; + height: 25px; + text-align: center; + cursor: pointer; + background-color: #F7F7F7; + border: solid 1px lightgrey; +} diff --git a/js/gpxedit.js b/js/gpxedit.js index f24f806..579932a 100644 --- a/js/gpxedit.js +++ b/js/gpxedit.js @@ -606,6 +606,10 @@ ' http://www.garmin.com/xmlschemas/TrackPointExtension/v1' + ' http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd">\n'; gpxText = gpxText + '\n \n'; + var trackName = $('#tracknameinput').val(); + if (trackName) { + gpxText = gpxText + ' ' + trackName + '\n'; + } var fileDesc = $('#desctext').val(); if (fileDesc) { gpxText = gpxText + ' ' + fileDesc + '\n'; @@ -847,6 +851,8 @@ var parseddom = $.parseXML(xml); var dom = $(parseddom); + var trackName = dom.find('gpx>metadata>name').text(); + $('#tracknameinput').val(trackName); var fileDesc = dom.find('gpx>metadata>desc').text(); $('#desctext').val(fileDesc); var linktext = dom.find('gpx>metadata>link>text').html(); @@ -1735,6 +1741,17 @@ } }); + $('body').on('click','#metadatalabel', function(e) { + if ($('div#metadata').is(':visible')) { + $('#metadata').slideUp(); + $(this).find('i').removeClass('fa-angle-double-up').addClass('fa-angle-double-down'); + } + else{ + $('div#metadata').slideDown(); + $(this).find('i').removeClass('fa-angle-double-down').addClass('fa-angle-double-up'); + } + }); + }); })(jQuery, OC); diff --git a/l10n/fr.json b/l10n/fr.json index c8c4b68..8f31ab4 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -69,6 +69,8 @@ "Transparent" : "Transparent", "Link URL (optional)" : "URL du lien (facultatif)", "Link text (optional)" : "Texte du lien (facultatif)", + "Track name (optional)" : "Nom de la trace (facultatif)", + "Metadata" : "Métadonnées", "Upload new symbol image" : "Téléverser une nouvelle image de symbole" },"pluralForm" :"nplurals=2; plural=(n > 1);" } diff --git a/templates/gpxcontent.php b/templates/gpxcontent.php index 5424b0b..7ecdfd6 100644 --- a/templates/gpxcontent.php +++ b/templates/gpxcontent.php @@ -31,20 +31,23 @@ -

t('Save'));?>

-
+
-
-
- -
-
-
- +

t('Metadata'));?>

+
+
+
+
+ +
+
+
+ +