Skip to content

Commit

Permalink
Redirect to external site (#2078)
Browse files Browse the repository at this point in the history
* redirect to external site

* move code
  • Loading branch information
anthonyshull authored May 28, 2024
1 parent 56d67ae commit 0666e37
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/dotcom_web/controllers/schedule_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule DotcomWeb.ScheduleController do

require Logger

plug(DotcomWeb.Plugs.Route when action not in [:schedules_for_stop])
plug(DotcomWeb.Plugs.Route when action not in [:cape_flyer, :schedules_for_stop])

@spec show(Plug.Conn.t(), map) :: Phoenix.HTML.Safe.t()
def show(%{query_params: %{"tab" => "timetable"} = query_params} = conn, _params) do
Expand Down Expand Up @@ -81,6 +81,10 @@ defmodule DotcomWeb.ScheduleController do
end
end

def cape_flyer(conn, _params) do
redirect(conn, external: "https://capeflyer.com")
end

defp future_departures(schedules, %{"future_departures" => "true"} = params) do
now = Util.now()
# Only list schedules with time in the future. The "time" property might be
Expand Down
2 changes: 2 additions & 0 deletions lib/dotcom_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ defmodule DotcomWeb.Router do
get("/style_guide", Redirector, to: "/style-guide")
get("/transit_near_me", Redirector, to: "/transit-near-me")

# redirect cape flyer to an external site
get("/schedules/CapeFlyer", ScheduleController, :cape_flyer)
# redirect SL and CT to proper route ids
get("/schedules/SL1", Redirector, to: "/schedules/741")
get("/schedules/sl1", Redirector, to: "/schedules/741")
Expand Down

0 comments on commit 0666e37

Please sign in to comment.