HTML: add Depth and Duration data to the dive list view.

Add the Depth and Duration information to the list view and make dives
sortable by them instead of the water and air temperatures.

Fixes #725

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2015-02-06 10:32:45 +02:00 committed by Dirk Hohndel
parent 7b44cf2a61
commit c97128102d
2 changed files with 29 additions and 30 deletions

View file

@ -121,6 +121,7 @@ window.onload=function(){
searchingModules["tags"].Enter_search_tag(items[i].tags,i); searchingModules["tags"].Enter_search_tag(items[i].tags,i);
} }
set_units();
sizeofpage=10; sizeofpage=10;
showAllDives(); showAllDives();
document.getElementById("divePanel").style.display='none'; document.getElementById("divePanel").style.display='none';
@ -132,8 +133,6 @@ window.onload=function(){
document.onkeydown = switchDives; document.onkeydown = switchDives;
set_units();
//translate Page //translate Page
translate_page(); translate_page();
getDefaultColor(); getDefaultColor();
@ -214,8 +213,8 @@ function changeAdvSearch(e){
<div id="date_header" onClick="change_sort_col('2')" class="item">Date</div> <div id="date_header" onClick="change_sort_col('2')" class="item">Date</div>
<div id="time_header" onClick="change_sort_col('3')" class="item">Time</div> <div id="time_header" onClick="change_sort_col('3')" class="item">Time</div>
<div id="location_header" onClick="change_sort_col('6')" class="item_large">Location</div> <div id="location_header" onClick="change_sort_col('6')" class="item_large">Location</div>
<div id="air_temp_header" onClick="change_sort_col('4')" class="item">Air temp</div> <div id="duration_header" onClick="change_sort_col('4')" class="item">Duration</div>
<div id="water_temp_header" onClick="change_sort_col('5')" class="item">Water temp</div> <div id="maxdepth_header" onClick="change_sort_col('5')" class="item">Max Depth</div>
</div> </div>
<div id="diveslist"> <div id="diveslist">
</div> </div>

View file

@ -200,8 +200,8 @@ function getlimited(dive)
'<div class="item">' + dive.date + '</div>' + '<div class="item">' + dive.date + '</div>' +
'<div class="item">' + dive.time + '</div>' + '<div class="item">' + dive.time + '</div>' +
'<div class="item_large">' + dive.location + '</div>' + '<div class="item_large">' + dive.location + '</div>' +
'<div class="item">' + dive.temperature.air + '</div>' + '<div class="item">' + dive.dive_duration + '</div>' +
'<div class="item">' + dive.temperature.water + '</div></div>'; '<div class="item">' + put_depth_unit(dive.maxdepth) + " " + depth_unit + '</div></div>';
}; };
function getExpanded(dive) function getExpanded(dive)
@ -266,8 +266,8 @@ each col. sorted asc or des
var number = true; var number = true;
var time = true; var time = true;
var date = true; var date = true;
var air = true; var duration = true;
var water = true; var depth = true;
var locat = true; var locat = true;
/* /*
@ -307,18 +307,18 @@ function list_sort(sortOn)
sort_it(sortOn, cmpTimeAsc); sort_it(sortOn, cmpTimeAsc);
} }
break; break;
case '4': //Air temp case '4': //Duration
if (air) { if (duration) {
sort_it(sortOn, cmpAtempDes); sort_it(sortOn, cmpDurDes);
} else { } else {
sort_it(sortOn, cmpAtempAsc); sort_it(sortOn, cmpDurAsc);
} }
break; break;
case '5': //Water temp case '5': //Max Depth
if (water) { if (depth) {
sort_it(sortOn, cmpWtempDes); sort_it(sortOn, cmpDepthDes);
} else { } else {
sort_it(sortOn, cmpWtempAsc); sort_it(sortOn, cmpDepthAsc);
} }
break; break;
case '6': //Location case '6': //Location
@ -343,11 +343,11 @@ function toggle_sort_state(sortOn)
case '3': //time case '3': //time
time = 1 - time; time = 1 - time;
break; break;
case '4': //Air temp case '4': //Duration
air = 1 - air; duration = 1 - duration;
break; break;
case '5': //Water temp case '5': //depth
water = 1 - water; depth = 1 - depth;
break; break;
case '6': //Location case '6': //Location
locat = 1 - locat; locat = 1 - locat;
@ -404,24 +404,24 @@ function cmpDateDes(j, iSmaller)
return items[j].date > items[iSmaller].date; return items[j].date > items[iSmaller].date;
} }
function cmpAtempAsc(j, iSmaller) function cmpDurAsc(j, iSmaller)
{ {
return parseFloat(items[j].temperature.air, 10) < parseFloat(items[iSmaller].temperature.air, 10); return items[j].duration < items[iSmaller].duration;
} }
function cmpAtempDes(j, iSmaller) function cmpDurDes(j, iSmaller)
{ {
return parseFloat(items[j].temperature.air, 10) > parseFloat(items[iSmaller].temperature.air, 10); return items[j].duration > items[iSmaller].duration;
} }
function cmpWtempAsc(j, iSmaller) function cmpDepthAsc(j, iSmaller)
{ {
return parseFloat(items[j].temperature.water, 10) < parseFloat(items[iSmaller].temperature.water, 10); return items[j].maxdepth < items[iSmaller].maxdepth;
} }
function cmpWtempDes(j, iSmaller) function cmpDepthDes(j, iSmaller)
{ {
return parseFloat(items[j].temperature.water, 10) > parseFloat(items[iSmaller].temperature.water, 10); return items[j].maxdepth > items[iSmaller].maxdepth;
} }
function sort_it(sortOn, function_) function sort_it(sortOn, function_)
@ -1328,8 +1328,8 @@ function translate_page()
document.getElementById("date_header").innerHTML = translate.Date; document.getElementById("date_header").innerHTML = translate.Date;
document.getElementById("time_header").innerHTML = translate.Time; document.getElementById("time_header").innerHTML = translate.Time;
document.getElementById("location_header").innerHTML = translate.Location; document.getElementById("location_header").innerHTML = translate.Location;
document.getElementById("air_temp_header").innerHTML = translate.Air_Temp; document.getElementById("duration_header").innerHTML = translate.Duration;
document.getElementById("water_temp_header").innerHTML = translate.Water_Temp; document.getElementById("maxdepth_header").innerHTML = translate.Max_Depth;
document.getElementById("adv_srch_sp").innerHTML = translate.Advanced_Search; document.getElementById("adv_srch_sp").innerHTML = translate.Advanced_Search;
document.getElementById("expnd_all_btn").innerHTML = translate.Expand_All; document.getElementById("expnd_all_btn").innerHTML = translate.Expand_All;
document.getElementById("claps_all_btn").innerHTML = translate.Collapse_All; document.getElementById("claps_all_btn").innerHTML = translate.Collapse_All;