add 'destination path' readonly field, design improved

merge-requests/1/head
Julien Veyssier 2016-12-12 17:54:23 +01:00
parent e2bd1c525b
commit 8aef60ba0c
4 changed files with 62 additions and 12 deletions

View File

@ -5,11 +5,13 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased] ## [Unreleased]
### ### Added
- file description field - file description field
- 'destination' readonly field indicating full save path
### Changed ### Changed
- keep time information in loaded tracks/routes/waypoints, written in saved files - keep time information in loaded tracks/routes/waypoints, written in saved files
- design : borders around file trees, button icons
## 0.0.2 2016-12-08 ## 0.0.2 2016-12-08
### Added ### Added

View File

@ -782,11 +782,27 @@ h2.popupTitle{
margin-right: auto; margin-right: auto;
display:block; display:block;
} }
#saveButton i{
color: blue;
}
#clearButton i{
color: red;
}
#saveButton{ #saveButton{
width:18%; width:18%;
display:block;
margin-left: auto;
margin-right: auto;
} }
#saveName{ #saveNameLabel, #savePathLabel{
width:78%; float:left;
}
#saveName, #savePath{
width: 78%;
float: right;
}
#savePath{
background-color: #C9C9C9;
} }
.selectimg{ .selectimg{
background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90); background: url('images/symbols/geocache-open.png') no-repeat right 8px center rgba(240, 240, 240, 0.90);
@ -796,3 +812,8 @@ h2.popupTitle{
width: 100%; width: 100%;
height: 70px; height: 70px;
} }
#loadtree, #savetree{
padding: 7px;
border: 1px solid black;
border-radius: 6px;
}

View File

@ -6,6 +6,7 @@ var gpxedit = {
baseLayers: null, baseLayers: null,
drawControl: null, drawControl: null,
id: 0, id: 0,
saveDirPath: '/',
// indexed by gpxedit_id // indexed by gpxedit_id
layersData: {} layersData: {}
}; };
@ -806,8 +807,9 @@ function loadAction(file){
var spl = file.split('/'); var spl = file.split('/');
var basename = spl[spl.length-1]; var basename = spl[spl.length-1];
$('input#saveName').val( $('input#saveName').val(
basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx') basename.replace(/\.jpg$/, '.gpx').replace(/\.kml$/, '.gpx').replace(/\.csv$/, '.gpx')
); );
updateSavePath();
} }
function loadFile(file){ function loadFile(file){
@ -999,6 +1001,15 @@ function fillWaypointStyles(){
$('select#markerstyleselect').val('marker'); $('select#markerstyleselect').val('marker');
} }
function updateSavePath(){
var dir = gpxedit.saveDirPath;
if (dir === '/'){
dir = '';
}
var filename = $('#saveName').val();
$('#savePath').val(dir+'/'+filename);
}
$(document).ready(function(){ $(document).ready(function(){
gpxedit.username = $('p#username').html(); gpxedit.username = $('p#username').html();
load_map(); load_map();
@ -1071,7 +1082,7 @@ $(document).ready(function(){
var saveFilePath = '/'+$('input#saveName').val(); var saveFilePath = '/'+$('input#saveName').val();
} }
else{ else{
var saveFilePath = gpxedit.savePath+'/'+$('input#saveName').val(); var saveFilePath = gpxedit.saveDirPath+'/'+$('input#saveName').val();
} }
var req = { var req = {
path: saveFilePath, path: saveFilePath,
@ -1114,15 +1125,20 @@ $(document).ready(function(){
}); });
$('#savetree').on('filetreeexpand', function(e, data){ $('#savetree').on('filetreeexpand', function(e, data){
gpxedit.savePath = data.rel; gpxedit.saveDirPath = data.rel;
$('#savetree a').removeClass('selectedFolder'); $('#savetree a').removeClass('selectedFolder');
data.li.find('>a').addClass('selectedFolder'); data.li.find('>a').addClass('selectedFolder');
updateSavePath();
}); });
$('#savetree').on('filetreecollapse', function(e, data){ $('#savetree').on('filetreecollapse', function(e, data){
gpxedit.savePath = data.li.parent().parent().find('>a').attr('rel'); gpxedit.saveDirPath = data.li.parent().parent().find('>a').attr('rel') || '/';
data.li.find('li.expanded').removeClass('expanded'); data.li.find('li.expanded').removeClass('expanded');
data.li.find('>a').removeClass('selectedFolder'); data.li.find('>a').removeClass('selectedFolder');
data.li.parent().parent().find('>a').addClass('selectedFolder'); data.li.parent().parent().find('>a').addClass('selectedFolder');
updateSavePath();
});
$('#saveName').on('input',function(e){
updateSavePath();
}); });
$('body').on('click','h2#loadtitle', function(e) { $('body').on('click','h2#loadtitle', function(e) {
@ -1166,6 +1182,7 @@ $(document).ready(function(){
if (urlfileparam && urlfileparam !== undefined){ if (urlfileparam && urlfileparam !== undefined){
loadAction(fileparam); loadAction(fileparam);
} }
updateSavePath();
}); });

View File

@ -40,15 +40,25 @@ p($_['gpxedit_version']);
<p>Select a folder, set a name and click "Save" button</p><br/> <p>Select a folder, set a name and click "Save" button</p><br/>
<div id="savetree"></div> <div id="savetree"></div>
<br/> <br/>
<input id="saveName"></input> <div>
<button id="saveButton">Save</button> <label id="saveNameLabel">File name :</label>
<br/> <input id="saveName" type="text"></input>
</div>
<div style="clear:both"></div>
<div>
<label id="savePathLabel">Destination :</label>
<input id="savePath" type="text" readonly></input>
</div>
<br/><br/>
<label>Description (optional) :</label><br/> <label>Description (optional) :</label><br/>
<textarea id="desctext"></textarea> <textarea id="desctext"></textarea>
<button id="saveButton"><i class="fa fa-save"></i> Save</button>
<br/>
</div> </div>
<div style="clear:both"></div> <div style="clear:both"></div>
<hr/> <hr/>
<button id="clearButton">Clear map</button> <br/>
<button id="clearButton"><i class="fa fa-bomb"></i> Clear map</button>
<div id="saved"><p> <div id="saved"><p>
<i class="fa fa-save fa-spin fa-3x fa-fw"></i> <i class="fa fa-save fa-spin fa-3x fa-fw"></i>
<b id="content"></b></p> <b id="content"></b></p>