Re: [PATCH] Reverse html trip list rendering order

2018-08-13 Thread Dirk Hohndel
BTW, I applied this on the server as well so that the logs shown at 
https://cloud.subsurface-divelog.org will also show trips in the logical order.
BUT: your browser is likely to cache the list_lib.js file, so you may have to 
clear the cache in order to see the effect

/D

> On Aug 13, 2018, at 8:28 AM, Monty Taylor  wrote:
> 
> In the HTML export, the list of trips emitted into lib.js is in
> chronological order, the dives are shown reverse chronological order.
> This leads to a weird experience of the earliest trip being on top and
> the dives within it having the most recent dive on top.
> 
> Invert the processing order in the javascript layer so that the last
> trip is rendered first.
> 
> Signed-off-by: Monty Taylor 
> ---
> theme/list_lib.js | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/theme/list_lib.js b/theme/list_lib.js
> index 34e4a6043..409229a91 100644
> --- a/theme/list_lib.js
> +++ b/theme/list_lib.js
> @@ -772,7 +772,7 @@ function showtrips()
> {
>   var divelist = document.getElementById('diveslist');
>   divelist.innerHTML = "";
> - for (var i = 0; i < trips.length; i++) {
> + for (var i = trips.length - 1; i >= 0; i--) {
>   divelist.innerHTML += ' onclick="toggle_trip_expansion(' + i + ')">' +
> trips[i].name + ' ( ' + 
> trips[i].dives.length + ' dives)' + '' + '';
>   };
> -- 
> 2.17.1
> 
> ___
> subsurface mailing list
> subsurface@subsurface-divelog.org
> http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


Re: [PATCH] Reverse html trip list rendering order

2018-08-13 Thread Dirk Hohndel

> On Aug 13, 2018, at 8:28 AM, Monty Taylor  wrote:
> 
> In the HTML export, the list of trips emitted into lib.js is in
> chronological order, the dives are shown reverse chronological order.
> This leads to a weird experience of the earliest trip being on top and
> the dives within it having the most recent dive on top.
> 
> Invert the processing order in the javascript layer so that the last
> trip is rendered first.
> 
> Signed-off-by: Monty Taylor 

Thanks for that patch. Nice catch - I wonder why I never noticed this rather 
obvious issue.

/D

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface


[PATCH] Reverse html trip list rendering order

2018-08-13 Thread Monty Taylor
In the HTML export, the list of trips emitted into lib.js is in
chronological order, the dives are shown reverse chronological order.
This leads to a weird experience of the earliest trip being on top and
the dives within it having the most recent dive on top.

Invert the processing order in the javascript layer so that the last
trip is rendered first.

Signed-off-by: Monty Taylor 
---
 theme/list_lib.js | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 34e4a6043..409229a91 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -772,7 +772,7 @@ function showtrips()
 {
var divelist = document.getElementById('diveslist');
divelist.innerHTML = "";
-   for (var i = 0; i < trips.length; i++) {
+   for (var i = trips.length - 1; i >= 0; i--) {
divelist.innerHTML += '' +
  trips[i].name + ' ( ' + 
trips[i].dives.length + ' dives)' + '' + '';
};
-- 
2.17.1

___
subsurface mailing list
subsurface@subsurface-divelog.org
http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface