diff options
author | stuebinm | 2022-11-29 16:38:21 +0100 |
---|---|---|
committer | stuebinm | 2022-11-29 16:38:21 +0100 |
commit | fb960c660357f9cd4dca57be1325e4ecbb50f649 (patch) | |
tree | 50ec4fdc1070252e7b52f72f40e5bfaa64efe2f7 /lib/Server | |
parent | 574115063dcbad49bdb9392fbf370618243b12c4 (diff) |
controlroom: show tripShortName instead of tripId
since the ids really should be internal to the gtfs, and not needed in
"normal" contexts.
Diffstat (limited to '')
-rw-r--r-- | lib/Server/ControlRoom.hs | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/lib/Server/ControlRoom.hs b/lib/Server/ControlRoom.hs index b1948f2..f291d82 100644 --- a/lib/Server/ControlRoom.hs +++ b/lib/Server/ControlRoom.hs @@ -162,8 +162,8 @@ getTrainsR = do [whamlet| <h1>Trains on #{day} <section><ol> - $forall Trip{..} <- trips - <li><a href="@{TrainViewR tripTripID day}">#{tripTripID}</a> + $forall trip@Trip{..} <- trips + <li><a href="@{TrainViewR tripTripID day}">#{tripName trip}</a> : #{stopDeparture (V.head tripStops)} #{stationName (stopStation (V.head tripStops))} |] @@ -184,7 +184,7 @@ getTrainViewR trip day = do mr <- getMessageRender setTitle (toHtml (""+|mr MsgTrip|+" "+|tripTripID|+" "+|mr Msgon|+" "+|day|+"" :: Text)) [whamlet| -<h1>_{MsgTrip} <a href="@{TripViewR tripTripID}">#{tripTripID}</a> _{Msgon} <a href="@?{(TrainsR, [("day", T.pack (iso8601Show day))])}">#{day}</a> +<h1>_{MsgTrip} <a href="@{TripViewR tripTripID}">#{tripName res}</a> _{Msgon} <a href="@?{(TrainsR, [("day", T.pack (iso8601Show day))])}">#{day}</a> <section> <h2>_{MsgLive} <p><strong>_{MsgLastPing}: </strong> @@ -246,8 +246,8 @@ getTripsViewR = do [whamlet| <h1>List of Trips <section><ul> - $forall Trip{..} <- trips - <li><a href="@{TripViewR tripTripID}">#{tripTripID}</a> + $forall trip@Trip{..} <- trips + <li><a href="@{TripViewR tripTripID}">#{tripName trip}</a> : #{stopDeparture (V.head tripStops)} #{stationName (stopStation (V.head tripStops))} |] @@ -257,8 +257,13 @@ getTripViewR tripId = do GTFS{..} <- getYesod <&> getGtfs case M.lookup tripId trips of Nothing -> notFound - Just Trip{..} -> defaultLayout [whamlet| -<h1>Trip #{tripTripID} + Just trip@Trip{..} -> defaultLayout [whamlet| +<h1>Trip #{tripName trip} +<section> + <h2>Info + <p><strong>_{MsgtripId}:</strong> #{tripTripID} + <p><strong>_{MsgtripHeadsign}:</strong> #{mightbe tripHeadsign} + <p><strong>_{MsgtripShortname}:</strong> #{mightbe tripShortName} <section> <h2>Stops <ol> @@ -339,7 +344,9 @@ announceForm day tripId = renderDivs $ Announcement <*> aopt urlField (fieldSettingsLabel MsgMaybeWeblink) Nothing <*> lift (liftIO getCurrentTime <&> Just) - +mightbe :: Maybe Text -> Text +mightbe (Just a) = a +mightbe Nothing = "" --- some orphans to make hamlet easier to deal with instance ToMarkup Time where |