summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBirte Kristina Friesel <derf@finalrewind.org>2023-12-27 12:33:48 +0100
committerBirte Kristina Friesel <derf@finalrewind.org>2023-12-27 12:35:09 +0100
commitb41a3523b369d178d3be23357ae9951e700cd821 (patch)
tree4e33102797e12fd2ace75ae305c80a7a3388fc65
parent44a48a1b9526197fc0b9c38799a6117aafd5cb3c (diff)
remove legacy map search / intersection views
-rw-r--r--lib/DBInfoscreen.pm4
-rw-r--r--lib/DBInfoscreen/Controller/Map.pm74
-rw-r--r--templates/_intersection_infobox.html.ep22
-rw-r--r--templates/route_map.html.ep3
-rw-r--r--templates/trainsearch.html.ep29
5 files changed, 0 insertions, 132 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm
index b55f0d7..9dcc2d0 100644
--- a/lib/DBInfoscreen.pm
+++ b/lib/DBInfoscreen.pm
@@ -328,14 +328,10 @@ sub startup {
$r->get('/_ajax_mapinfo/:tripid/:lineno')->to('map#ajax_route');
$r->get('/map/:tripid/:lineno')->to('map#route');
- $r->get('/intersection/:trips')->to('map#intersection');
$r->get( '/z/:train/*station' => 'train_at_station' )
->to('stationboard#station_train_details');
$r->get( '/z/:train' => 'train' )->to('stationboard#train_details');
- $r->get('/map')->to('map#search_form');
- $r->get('/_trainsearch')->to('map#search');
-
$self->defaults( layout => 'app' );
$r->get('/')->to('stationboard#handle_request');
diff --git a/lib/DBInfoscreen/Controller/Map.pm b/lib/DBInfoscreen/Controller/Map.pm
index 9fb1e0e..e552a18 100644
--- a/lib/DBInfoscreen/Controller/Map.pm
+++ b/lib/DBInfoscreen/Controller/Map.pm
@@ -509,78 +509,4 @@ sub ajax_route {
)->wait;
}
-sub search {
- my ($self) = @_;
-
- my $t1 = $self->param('train1');
- my $t2 = $self->param('train2');
-
- my $t1_data;
- my $t2_data;
-
- my @requests;
-
- if ( not( $t1 and $t1 =~ m{^\S+\s+\d+$} )
- or ( $t2 and not $t2 =~ m{^\S+\s+\d+$} ) )
- {
- $self->render(
- 'trainsearch',
- title => 'Fahrtverlauf',
- hide_opts => 1,
- error => $t1
- ? "Züge müssen im Format 'Zugtyp Nummer' angegeben werden, z.B. 'RE 1234'"
- : undef,
- );
- return;
- }
-
- $self->render_later;
-
- push( @requests, $self->hafas->trainsearch_p( train_no => $t1 ) );
-
- if ($t2) {
- push( @requests, $self->hafas->trainsearch_p( train_no => $t2 ) );
- }
-
- Mojo::Promise->all(@requests)->then(
- sub {
- my ( $t1_data, $t2_data ) = @_;
-
- if ($t2_data) {
- $self->redirect_to(
- sprintf(
- "/intersection/%s,0;%s,0",
- $t1_data->[0]{trip_id},
- $t2_data->[0]{trip_id},
- )
- );
- }
- else {
- $self->redirect_to(
- sprintf( "/map/%s/0", $t1_data->[0]{trip_id}, ) );
- }
- }
- )->catch(
- sub {
- my ($err) = @_;
- $self->render(
- 'trainsearch',
- title => 'Fahrtverlauf',
- hide_opts => 1,
- error => $err
- );
- }
- )->wait;
-}
-
-sub search_form {
- my ($self) = @_;
-
- $self->render(
- 'trainsearch',
- title => 'Fahrtverlauf',
- hide_opts => 1,
- );
-}
-
1;
diff --git a/templates/_intersection_infobox.html.ep b/templates/_intersection_infobox.html.ep
deleted file mode 100644
index cb27d19..0000000
--- a/templates/_intersection_infobox.html.ep
+++ /dev/null
@@ -1,22 +0,0 @@
-<div class="container" id="infobox2" style="margin-top: 1ex; margin-bottom: 1ex;">
-<div class="journey" id="jdata"
-data-req="<%= stash('ajax_req') %>"
-data-route="<%= stash('ajax_route') %>"
-data-poly="<%= stash('ajax_polyline') %>"
->
- <strong><%= stash('train1_no') %></strong>
- und
- <strong><%= stash('train2_no') %></strong>
- werden sich wahrscheinlich
- % if (my $t = stash('time')) {
- gegen <strong><%= $t->strftime('%H:%M') %> Uhr</strong>
- % }
- % if (my $p = stash('likely_pair')) {
- zwischen <strong><%= $p->[0] %></strong> und <strong><%= $p->[1] %></strong>
- % }
- % if (not stash('time')) {
- nicht
- % }
- begegnen.
-</div>
-</div>
diff --git a/templates/route_map.html.ep b/templates/route_map.html.ep
index 2822b6c..502b7fd 100644
--- a/templates/route_map.html.ep
+++ b/templates/route_map.html.ep
@@ -1,9 +1,6 @@
% if (stash('origin') and stash('destination')) {
%= include '_map_infobox'
% }
-% elsif (stash('intersection')) {
- %= include '_intersection_infobox'
-% }
<div class="container">
<div id="map" style="height: 500px;">
diff --git a/templates/trainsearch.html.ep b/templates/trainsearch.html.ep
deleted file mode 100644
index 5d6d3f9..0000000
--- a/templates/trainsearch.html.ep
+++ /dev/null
@@ -1,29 +0,0 @@
-<div class="container">
- <div class="input-field">
- %= form_for _trainsearch => begin
- <div>
- <div class="field">
- <div class="desc">Zug</div>
- <div>
- %= text_field 'train1', placeholder => 'RE 1234', id => 'train1_input', autofocus => 'autofocus'
- </div>
- </div>
- <div class="field">
- %= submit_button 'Strecke zeigen'
- </div>
- <div class="break"></div>
- <div class="field">
- <div class="desc">
- Zweiter Zug (optional)
- </div>
- <div>
- %= text_field 'train2', placeholder => 'S 5678', id => 'train2_input'
- </div>
- </div>
- <div class="field">
- %= submit_button 'Begegnungen suchen (beta)'
- </div>
- </div>
- % end
- </div>
-</div>