summaryrefslogtreecommitdiff
path: root/cgi/index.pl
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-06-21 14:58:46 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-06-21 14:58:46 +0200
commitfe9dc6c86ae97554898fa9c8172cb6c043d2fcd1 (patch)
treeb33e595bdb6df7430df6031b8214eaa4e4587096 /cgi/index.pl
parenta750d073f232e4728a7f426e4e77ca82e53059a0 (diff)
IRIS backend: Use dropdown menu to narrow down stations
Diffstat (limited to 'cgi/index.pl')
-rw-r--r--cgi/index.pl12
1 files changed, 12 insertions, 0 deletions
diff --git a/cgi/index.pl b/cgi/index.pl
index 8558ec3..531ee5e 100644
--- a/cgi/index.pl
+++ b/cgi/index.pl
@@ -4,6 +4,7 @@ use Cache::File;
use List::MoreUtils qw(any);
use Travel::Status::DE::DeutscheBahn;
use Travel::Status::DE::IRIS;
+use Travel::Status::DE::IRIS::Stations;
use 5.014;
use utf8;
@@ -79,6 +80,17 @@ sub handle_request {
my @results = get_results_for( $backend, $station );
if ( not @results ) {
+ if ( $backend eq 'iris' ) {
+ my @candidates = map { [ "$_->[1] ($_->[0])", $_->[0] ] }
+ Travel::Status::DE::IRIS::Stations::get_station($station);
+ if (@candidates) {
+ $self->render(
+ 'multi',
+ stationlist => \@candidates,
+ hide_opts => 0
+ );
+ }
+ }
$self->render(
'multi',
error => "Got no results for '$station'",