manual station entry: HAFAS support

This commit is contained in:
Birte Kristina Friesel 2023-08-18 20:42:37 +02:00
parent 379da61de4
commit 54547eb3af
No known key found for this signature in database
GPG key ID: 19E6E524EBB177BA
2 changed files with 12 additions and 2 deletions

View file

@ -1095,7 +1095,17 @@ sub redirect_to_station {
my ($self) = @_; my ($self) = @_;
my $station = $self->param('station'); my $station = $self->param('station');
$self->redirect_to("/s/${station}"); if ( my $s = $self->app->stations->search($station) ) {
if ( $s->{hafas} ) {
$self->redirect_to("/s/${station}?hafas=1");
}
else {
$self->redirect_to("/s/${station}");
}
}
else {
$self->redirect_to("/s/${station}?hafas=1");
}
} }
sub cancelled { sub cancelled {

View file

@ -61,7 +61,7 @@
%= form_for 'list_departures' => begin %= form_for 'list_departures' => begin
<div class="input-field"> <div class="input-field">
%= text_field 'station', id => 'station', class => 'autocomplete contrast-color-text', autocomplete => 'off', required => undef %= text_field 'station', id => 'station', class => 'autocomplete contrast-color-text', autocomplete => 'off', required => undef
<label for="station">Manuelle Eingabe (Name oder DS100)</label> <label for="station">Manuelle Eingabe</label>
</div> </div>
<div class="center-align"> <div class="center-align">
<button class="btn waves-effect waves-light btn-flat" type="submit" name="action" value="departures"> <button class="btn waves-effect waves-light btn-flat" type="submit" name="action" value="departures">