diff options
author | Birte Kristina Friesel <derf@finalrewind.org> | 2024-07-24 21:11:45 +0200 |
---|---|---|
committer | Birte Kristina Friesel <derf@finalrewind.org> | 2024-07-24 21:11:59 +0200 |
commit | 2558df1b91e8aa2116fa88e34fc09055dca900ec (patch) | |
tree | 3036c37ca4961642b89b6a0b16f0d86317ad16f1 | |
parent | fe3037348459ed7e4e54b13281e0a1e82a94a78f (diff) |
add a prominent backend selection link
-rw-r--r-- | lib/DBInfoscreen.pm | 2 | ||||
-rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 29 | ||||
-rw-r--r-- | sass/app.scss | 4 | ||||
-rw-r--r-- | templates/_backend.html.ep | 10 | ||||
-rw-r--r-- | templates/layouts/app.html.ep | 3 |
5 files changed, 48 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index 174fc97..2e15eb3 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -301,6 +301,8 @@ sub startup { $r->get('/_autostop')->to('static#geostop'); + $r->get('/_backend')->to('stationboard#backend_list'); + $r->get('/_datenschutz')->to('static#privacy'); $r->post('/_geolocation')->to('stationboard#stations_by_coordinates'); diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index 971ff80..bb45454 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -2141,6 +2141,35 @@ sub stations_by_coordinates { )->wait; } +sub backend_list { + my ($self) = @_; + + my @backends = ( + { + name => 'Deutsche Bahn', + type => 'IRIS-TTS', + } + ); + + for my $backend ( Travel::Status::DE::HAFAS::get_services() ) { + push( + @backends, + { + name => $backend->{name}, + shortname => $backend->{shortname}, + type => 'HAFAS', + hafas => 1, + } + ); + } + + $self->render( + '_backend', + backends => \@backends, + hide_opts => 1 + ); +} + sub autocomplete { my ($self) = @_; diff --git a/sass/app.scss b/sass/app.scss index 4d02ee1..f92d5dc 100644 --- a/sass/app.scss +++ b/sass/app.scss @@ -1010,6 +1010,10 @@ input[type="submit"]:active, border-color: $button-hover-border; } +div.backendlink { + margin-top: 1ex; +} + div.notes { margin-top: 2em; } diff --git a/templates/_backend.html.ep b/templates/_backend.html.ep new file mode 100644 index 0000000..159d325 --- /dev/null +++ b/templates/_backend.html.ep @@ -0,0 +1,10 @@ +<div class="container"> + <p> + Die folgenden Backends werden derzeit unterstützt: + </p> + <p> + % for my $backend (@{$backends}) { + <a class="button" href="<%= url_for(q{/})->query({ hafas => $backend->{hafas} ? $backend->{shortname} : q{} }) %>"><%= $backend->{name} %> (<%= $backend->{type} %>)</a> + % } + </p> +</div> diff --git a/templates/layouts/app.html.ep b/templates/layouts/app.html.ep index 579fb80..7d8bfca 100644 --- a/templates/layouts/app.html.ep +++ b/templates/layouts/app.html.ep @@ -141,6 +141,9 @@ Bitte eine Station aus der Liste auswählen</div> <a class="button" href="<%= url_for('_autostop')->to_abs->scheme('https')->query({hafas => param('hafas')}) %>">Stationen in der Umgebung suchen</a> </div> % } + <div class="backendlink"> + <a class="button button-light" href="<%= url_for('_backend')->query({hafas => param('hafas')}) %>">Backend: <%= param('hafas') ? param('hafas') . ' (HAFAS)' : 'DB (IRIS-TTS)' %></a> + </div> <div class="break"></div> <div class="moresettings-header moresettings-header-collapsed button button-light">Weitere Einstellungen</div> <div class="moresettings moresettings-collapsed"> |