diff options
author | Gehad elrobey <gehadelrobey@gmail.com> | 2014-07-11 03:26:21 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-07-14 21:38:22 -0700 |
commit | 346f71f2624e4035b664bc93d03a835412c29ec0 (patch) | |
tree | 084eea9f5e0b08c078139c990966d644359f74b7 | |
parent | 6a5dcb485924a46509dfad04bdc5c6fee71f6002 (diff) | |
download | subsurface-346f71f2624e4035b664bc93d03a835412c29ec0.tar.gz |
HTML: display dive status in detailed view
Add dive status in the detailed dive view.
Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | save-html.c | 8 | ||||
-rw-r--r-- | theme/list_lib.js | 13 |
2 files changed, 20 insertions, 1 deletions
diff --git a/save-html.c b/save-html.c index 13bf70c14..2d03bca76 100644 --- a/save-html.c +++ b/save-html.c @@ -11,6 +11,13 @@ void write_attribute(struct membuffer *b, const char *att_name, const char *valu put_string(b, "\","); } +void write_dive_status(struct membuffer *b, struct dive *dive) +{ + put_format(b, "\"sac\":\"%d\",", dive->sac); + put_format(b, "\"otu\":\"%d\",", dive->otu); + put_format(b, "\"cns\":\"%d\",", dive->cns); +} + void put_HTML_bookmarks(struct membuffer *b, struct dive *dive) { struct event *ev = dive->dc.events; @@ -172,6 +179,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const write_attribute(b, "buddy", dive->buddy); write_attribute(b, "divemaster", dive->divemaster); write_attribute(b, "suit", dive->suit); + write_dive_status(b, dive); put_HTML_tags(b, dive, "\"tags\":", ","); put_HTML_notes(b, dive, "\"notes\":\"", "\","); if (!list_only) { diff --git a/theme/list_lib.js b/theme/list_lib.js index 7135369d0..0a61ed765 100644 --- a/theme/list_lib.js +++ b/theme/list_lib.js @@ -734,7 +734,6 @@ function get_bookmarks_HTML(dive) return result; } - /** *Return HTML main data of a dive */ @@ -756,6 +755,17 @@ function get_dive_HTML(dive) '</td></tr></table><div style="margin:10px;"><p class="words">Notes: </p>' + dive.notes + '</div>'; }; +/** +*Return HTML dive status data +*/ +function get_status_HTML(dive) +{ + return '<h2 class="det_hed">Dive Status</h2><table><tr><td class="words">Sac: </td><td>' + dive.sac + + '</td><td class="words">     Otu: </td><td>' + dive.otu + + '</td><td class="words">     Cns: </td><td>' + dive.cns + + '</td></tr></table>'; +}; + function mkelvin_to_C(mkelvin) { return (mkelvin - ZERO_C_IN_MKELVIN) / 1000.0; @@ -937,6 +947,7 @@ function showDiveDetails(dive) document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]); document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]); document.getElementById("bookmarks").innerHTML = get_bookmarks_HTML(items[dive_id]); + document.getElementById("divestats").innerHTML = get_status_HTML(items[dive_id]); setDiveTitle(items[dive_id]); //hide the list of dives and show the canvas. |