Loading lib/Travelynx/Controller/Traveling.pm +41 −7 Original line number Diff line number Diff line Loading @@ -1074,20 +1074,54 @@ sub station { )->catch( sub { my ( $err, $status ) = @_; if ($status) { if ( $status and $status->{suggestions} ) { $self->render( 'landingpage', with_autocomplete => 1, with_geolocation => 1, error => $status->{errstr}, status => 400, 'disambiguation', suggestions => $status->{suggestions}, status => 300, ); } elsif ( $use_hafas and $status and $status->errcode eq 'LOCATION' ) { $status->similar_stops_p->then( sub { my @suggestions = @_; if ( @suggestions == 1 ) { $self->redirect_to( '/s/' . $suggestions[0]->{id} . '?hafas=1' ); } else { $self->render( 'disambiguation', suggestions => [ map { { name => $_->{name}, eva => $_->{id} } } @suggestions ], status => 300, ); } } )->catch( sub { my ($err2) = @_; $self->render( 'exception', exception => "StopFinder threw '$err2' when handling '$err'", status => 502 ); } )->wait; } else { $self->render( 'exception', exception => $err, status => 500 status => 502 ); } } Loading lib/Travelynx/Helper/IRIS.pm +6 −4 Original line number Diff line number Diff line Loading @@ -154,9 +154,11 @@ sub get_departures_p { 'ambiguous station name', { results => [], errstr => "Mehrdeutiger Stationsname: '$station'. Mögliche Eingaben: " . join( q{, }, map { $_->[1] } @station_matches ), errstr => "Mehrdeutiger Stationsname: '$station'", suggestions => [ map { { name => $_->[1], eva => $_->[2] } } @station_matches ], } ); } Loading sass/src/common/local.scss +7 −0 Original line number Diff line number Diff line Loading @@ -64,3 +64,10 @@ h3 { font-size: 16px; } } ul.suggestions { li { padding-top: 0.5rem; padding-bottom: 0.5rem; } } templates/disambiguation.html.ep 0 → 100644 +20 −0 Original line number Diff line number Diff line <div class="row"> <div class="col s12"> <div class="card info-color"> <div class="card-content"> <span class="card-title">Mehrdeutige Eingabe</span> <p>„<%= $station %>“ ist nicht eindeutig. Bitte wähle eine der folgenden Optionen aus.</p> </div> </div> </div> </div> <div class="row"> <div class="col s12"> <ul class="suggestions"> % for my $suggestion (@{$suggestions // []}) { <li><a href="<%= url_for('station' => $suggestion->{eva}) . (param('hafas') ? '?hafas=1' : q{}) %>"><%= $suggestion->{name} %></a></li> % } </ul> </div> </div> Loading
lib/Travelynx/Controller/Traveling.pm +41 −7 Original line number Diff line number Diff line Loading @@ -1074,20 +1074,54 @@ sub station { )->catch( sub { my ( $err, $status ) = @_; if ($status) { if ( $status and $status->{suggestions} ) { $self->render( 'landingpage', with_autocomplete => 1, with_geolocation => 1, error => $status->{errstr}, status => 400, 'disambiguation', suggestions => $status->{suggestions}, status => 300, ); } elsif ( $use_hafas and $status and $status->errcode eq 'LOCATION' ) { $status->similar_stops_p->then( sub { my @suggestions = @_; if ( @suggestions == 1 ) { $self->redirect_to( '/s/' . $suggestions[0]->{id} . '?hafas=1' ); } else { $self->render( 'disambiguation', suggestions => [ map { { name => $_->{name}, eva => $_->{id} } } @suggestions ], status => 300, ); } } )->catch( sub { my ($err2) = @_; $self->render( 'exception', exception => "StopFinder threw '$err2' when handling '$err'", status => 502 ); } )->wait; } else { $self->render( 'exception', exception => $err, status => 500 status => 502 ); } } Loading
lib/Travelynx/Helper/IRIS.pm +6 −4 Original line number Diff line number Diff line Loading @@ -154,9 +154,11 @@ sub get_departures_p { 'ambiguous station name', { results => [], errstr => "Mehrdeutiger Stationsname: '$station'. Mögliche Eingaben: " . join( q{, }, map { $_->[1] } @station_matches ), errstr => "Mehrdeutiger Stationsname: '$station'", suggestions => [ map { { name => $_->[1], eva => $_->[2] } } @station_matches ], } ); } Loading
sass/src/common/local.scss +7 −0 Original line number Diff line number Diff line Loading @@ -64,3 +64,10 @@ h3 { font-size: 16px; } } ul.suggestions { li { padding-top: 0.5rem; padding-bottom: 0.5rem; } }
templates/disambiguation.html.ep 0 → 100644 +20 −0 Original line number Diff line number Diff line <div class="row"> <div class="col s12"> <div class="card info-color"> <div class="card-content"> <span class="card-title">Mehrdeutige Eingabe</span> <p>„<%= $station %>“ ist nicht eindeutig. Bitte wähle eine der folgenden Optionen aus.</p> </div> </div> </div> </div> <div class="row"> <div class="col s12"> <ul class="suggestions"> % for my $suggestion (@{$suggestions // []}) { <li><a href="<%= url_for('station' => $suggestion->{eva}) . (param('hafas') ? '?hafas=1' : q{}) %>"><%= $suggestion->{name} %></a></li> % } </ul> </div> </div>