diff options
| author | Daniel Friesel <derf@finalrewind.org> | 2023-02-04 18:22:18 +0100 | 
|---|---|---|
| committer | Daniel Friesel <derf@finalrewind.org> | 2023-02-04 18:22:18 +0100 | 
| commit | 91a40424443bb5522e9350305ed452c9fae47a1b (patch) | |
| tree | cc0b56dbd1edf2015c7182ff8001ba432792c535 /lib/DBInfoscreen | |
| parent | ac1a4336430431b84c26ac629545e78c84158685 (diff) | |
departure board: add regional / local transit switcher; move autostop to bottom
Diffstat (limited to 'lib/DBInfoscreen')
| -rw-r--r-- | lib/DBInfoscreen/Controller/Stationboard.pm | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/lib/DBInfoscreen/Controller/Stationboard.pm b/lib/DBInfoscreen/Controller/Stationboard.pm index bf986d3..39b3a3d 100644 --- a/lib/DBInfoscreen/Controller/Stationboard.pm +++ b/lib/DBInfoscreen/Controller/Stationboard.pm @@ -456,6 +456,13 @@ sub handle_request {  				results       => [ $status->results ],  				station_ds100 =>  				  ( $status->station ? $status->station->{ds100} : undef ), +				station_eva => ( +					$status->station +					? ( $status->station->{uic} // $status->station->{eva} ) +					: undef +				), +				station_evas => +				  ( $status->station ? $status->station->{evas} : [] ),  				station_name =>  				  ( $status->station ? $status->station->{name} : $station ),  			}; @@ -1650,8 +1657,28 @@ sub handle_result {  	}  	else {  		my $station_name = $data->{station_name} // $self->stash('station'); +		my ( $api_link, $api_text, $api_icon ); +		my $params = $self->req->params->clone; +		$params->param( hafas => not $params->param('hafas') ); +		if ( $params->param('hafas') ) { +			$api_link = '/' . $data->{station_eva} . '?' . $params->to_string; +			$api_text = 'lol'; +			$api_icon = 'train'; +		} +		else { +			my $iris_eva = List::Util::min grep { $_ >= 1000000 } +			  @{ $data->{station_evas} // [] }; +			if ($iris_eva) { +				$api_link = '/' . $iris_eva . '?' . $params->to_string; +				$api_text = 'lol'; +				$api_icon = 'directions_bus'; +			} +		}  		$self->render(  			$template, +			api_link         => $api_link, +			api_text         => $api_text, +			api_icon         => $api_icon,  			departures       => \@departures,  			ice_type         => $self->app->ice_type_map,  			station          => $station_name, | 
