From 476b02157b9520f1c80a8393c86e7111508c90c7 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 9 Mar 2015 18:56:35 +0100 Subject: station dropdown: use legible station names, not codes --- index.pl | 16 +++++++++++----- templates/barform.html.ep | 8 ++++---- templates/topform.html.ep | 8 ++++---- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/index.pl b/index.pl index 2864059..d938a4a 100644 --- a/index.pl +++ b/index.pl @@ -98,7 +98,7 @@ helper barplot_filters => sub { my $ret = { lines => [ - map { $_->[0] } @{ + map { [ $_->[0], $_->[0] ] } @{ $dbh->selectall_arrayref( "select distinct train_type || ' ' || line_no as line from $table order by line" ) @@ -106,7 +106,7 @@ helper barplot_filters => sub { ], train_types => [ q{}, - map { $_->[0] } @{ + map { [ $_->[0], $_->[0] ] } @{ $dbh->selectall_arrayref( "select distinct train_type from $table order by train_type" ) @@ -114,14 +114,20 @@ helper barplot_filters => sub { ], stations => [ q{}, - map { $_->[0] } @{ + map { + [ + Travel::Status::DE::IRIS::Stations::get_station( $_->[0] ) + ->[1], + $_->[0] + ] + } @{ $dbh->selectall_arrayref( "select distinct station from $table order by station") - } + } ], destinations => [ q{}, - map { decode( 'utf8', $_->[0] ) } @{ + map { [ decode( 'utf8', $_->[0] ), decode( 'utf8', $_->[0] ) ] } @{ $dbh->selectall_arrayref( "select distinct destination from $table order by destination" ) diff --git a/templates/barform.html.ep b/templates/barform.html.ep index 0b8b82d..7aa329e 100644 --- a/templates/barform.html.ep +++ b/templates/barform.html.ep @@ -34,7 +34,7 @@ Optionale Einschränkungen: Linie:
- %= select_field filter_line => [map {[$_, $_]} @{$filter_opts->{lines}} ] + %= select_field filter_line => $filter_opts->{lines}
@@ -42,7 +42,7 @@ Optionale Einschränkungen: Zugtyp:
- %= select_field filter_train_type => [map {[$_, $_]} @{$filter_opts->{train_types}} ] + %= select_field filter_train_type => $filter_opts->{train_types}
@@ -50,7 +50,7 @@ Optionale Einschränkungen: Bahnhof:
- %= select_field filter_station => [map {[$_, $_]} @{$filter_opts->{stations}} ] + %= select_field filter_station => $filter_opts->{stations}
@@ -58,7 +58,7 @@ Optionale Einschränkungen: Zielbahnhof:
- %= select_field filter_destination => [map {[$_, $_]} @{$filter_opts->{destinations}} ] + %= select_field filter_destination => $filter_opts->{destinations}
diff --git a/templates/topform.html.ep b/templates/topform.html.ep index f92c283..ee2e784 100644 --- a/templates/topform.html.ep +++ b/templates/topform.html.ep @@ -8,7 +8,7 @@ Die Einschränkungen sind alle optional. Linie:
- %= select_field filter_line => [map {[$_, $_]} @{$filter_opts->{lines}} ] + %= select_field filter_line => $filter_opts->{lines}
@@ -16,7 +16,7 @@ Die Einschränkungen sind alle optional. Zugtyp:
- %= select_field filter_train_type => [map {[$_, $_]} @{$filter_opts->{train_types}} ] + %= select_field filter_train_type => $filter_opts->{train_types}
@@ -24,7 +24,7 @@ Die Einschränkungen sind alle optional. Bahnhof:
- %= select_field filter_station => [map {[$_, $_]} @{$filter_opts->{stations}} ] + %= select_field filter_station => $filter_opts->{stations}
@@ -32,7 +32,7 @@ Die Einschränkungen sind alle optional. Zielbahnhof:
- %= select_field filter_destination => [map {[$_, $_]} @{$filter_opts->{destinations}} ] + %= select_field filter_destination => $filter_opts->{destinations}
-- cgit v1.2.3