diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-01 22:17:25 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-10-01 22:17:25 +0200 |
commit | 7fb44a0ad3f02064a9f774f7482108bdadd4623f (patch) | |
tree | 4fffbe92b19bb80d7f3bff6c374cb29d87cf4937 | |
parent | 6af85253f33bafd722e04f62a7418510c971fcdd (diff) |
Prepare for detail view with efa backend
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 14 | ||||
-rw-r--r-- | public/static/js/collapse.js | 2 | ||||
-rw-r--r-- | templates/app.html.ep | 7 |
3 files changed, 17 insertions, 6 deletions
diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index dbae28a..14ac3be 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -1532,10 +1532,16 @@ sub handle_efa { departure => $result->rt_datetime ? $result->rt_datetime->strftime('%H:%M') : undef, - train => $result->line, - train_type => q{}, - train_line => $result->line, - train_no => $result->train_no, + train => $result->line, + train_type => q{}, + train_line => $result->line, + train_no => $result->train_no, + journey_id => sprintf( '%s@%d(%s)%d', + $result->stateless, + scalar $result->route_pre ? ( $result->route_pre )[0]->id + : $result->stop_id, + $result->sched_datetime->strftime('%Y%m%d'), + $result->key ), via => [ map { $_->name } $result->route_interesting ], origin => $result->origin, destination => $result->destination, diff --git a/public/static/js/collapse.js b/public/static/js/collapse.js index d7d1e3b..6664795 100644 --- a/public/static/js/collapse.js +++ b/public/static/js/collapse.js @@ -124,6 +124,8 @@ function dbf_reg_handlers() { } if (param.get('hafas') && param.get('hafas') != '0') { history.pushState({'page':'traindetail','jid':trainElem.data('jid')}, 'test', '/z/' + trainElem.data('jid') + suffix); + } else if (param.get('efa') && param.get('efa') != '0') { + history.pushState({'page':'traindetail','jid':trainElem.data('jid')}, 'test', '/z/' + trainElem.data('jid') + suffix); } else { history.pushState({'page':'traindetail','station':station,'train':trainElem.data('no')}, 'test', '/z/' + trainElem.data('train') + '/' + trainElem.data('station') + suffix); } diff --git a/templates/app.html.ep b/templates/app.html.ep index a499dd7..2cd628f 100644 --- a/templates/app.html.ep +++ b/templates/app.html.ep @@ -30,7 +30,7 @@ % $route_str .= $stop . ($via_cur < $via_max ? ' - ' : q{}); % } <li -% if (param('hafas')) { +% if (param('hafas') or param('efa')) { data-jid="<%= $departure->{journey_id} =~ s{#}{%23}gr %>" % } data-train="<%= ($departure->{train_type} // q{}) %> <%= ($departure->{train_no} // $departure->{train} // q{}) %>" @@ -55,7 +55,10 @@ % if (param('hafas')) { <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?hafas=' . Mojo::Util::url_escape(param('hafas')) . '&highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>"> % } -% elsif (not param('efa')) { +% elsif (param('efa')) { + <a href="/z/<%= Mojo::Util::url_escape($departure->{journey_id}) . '?efa=' . Mojo::Util::url_escape(param('efa')) . '&highlight=' . Mojo::Util::url_escape($departure->{station} // $station) %>"> +% } +% else { <a href="/z/<%= Mojo::Util::url_escape(($departure->{train_type} // q{}) . ' ' . ($departure->{train_no} // $departure->{train} // q{})) . '/' . Mojo::Util::url_escape($departure->{station} // $station) %>"> % } <div class="anchor" id="<%= ($departure->{train_type} // q{x}) . ($departure->{train_no} // q{x}) %>"></div> |