From ba474abfb3816b2a9d57540eff54b8b2f1c52b85 Mon Sep 17 00:00:00 2001 From: Cristen Jones Date: Tue, 17 Sep 2024 11:28:35 -0400 Subject: [PATCH] chore: migrate to `PhoenixHTMLHelpers` (#2172) * deps(mix): install phoenix_html_helpers * chore: migrate to PhoenixHTMLHelpers * chore: remove unused alias --- lib/build_calendar.ex | 4 ++-- lib/dotcom/body_tag.ex | 2 +- .../components/buttons/button_group/arguments.ex | 2 +- .../buttons/button_group/component.html.eex | 7 +++---- lib/dotcom/components/icons/svg_icon/arguments.ex | 2 +- .../components/tabs/tab_selector/component.html.eex | 2 +- lib/dotcom/content_rewriters/liquid_objects.ex | 2 +- lib/dotcom/schedule_note.ex | 4 ++-- lib/dotcom/trip_plan/related_link.ex | 2 +- lib/dotcom_web.ex | 4 +++- lib/dotcom_web/ambiguous_alert.ex | 4 ++-- lib/dotcom_web/controllers/mode/bus.ex | 2 +- lib/dotcom_web/controllers/mode/commuter.ex | 2 +- lib/dotcom_web/templates/alert/_t-alerts.html.eex | 2 +- .../templates/partial/_search_input.html.eex | 2 +- lib/dotcom_web/views/alert_view.ex | 2 +- lib/dotcom_web/views/customer_support_view.ex | 2 +- lib/dotcom_web/views/date_time_selector.ex | 2 +- lib/dotcom_web/views/error_helpers.ex | 2 +- lib/dotcom_web/views/event_view.ex | 2 +- lib/dotcom_web/views/fare_view.ex | 2 -- lib/dotcom_web/views/helpers.ex | 4 ++-- lib/dotcom_web/views/helpers/cms_helpers.ex | 2 +- lib/dotcom_web/views/helpers/search_helpers.ex | 4 ++-- lib/dotcom_web/views/page_view.ex | 2 +- lib/dotcom_web/views/partial/fullscreen_error.ex | 2 +- lib/dotcom_web/views/partial/header_tabs.ex | 2 +- .../views/partial/svg_icon_with_circle.ex | 2 +- lib/dotcom_web/views/schedule/timetable.ex | 2 +- lib/dotcom_web/views/search_view.ex | 2 +- lib/dotcom_web/views/trip_plan_view.ex | 13 +++++++------ lib/journey.ex | 2 +- lib/util/breadcrumb_html.ex | 2 +- mix.exs | 3 +-- mix.lock | 3 ++- test/dotcom_web/views/helpers_test.exs | 2 +- test/dotcom_web/views/schedule_view_test.exs | 2 +- 37 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/build_calendar.ex b/lib/build_calendar.ex index 0a9ca8f276..0f08b558f8 100644 --- a/lib/build_calendar.ex +++ b/lib/build_calendar.ex @@ -59,8 +59,8 @@ defmodule BuildCalendar do url: nil, today?: false - import Phoenix.HTML.Tag - import Phoenix.HTML.Link + import PhoenixHTMLHelpers.Tag + import PhoenixHTMLHelpers.Link @spec td(t) :: Phoenix.HTML.Safe.t() def td(%Day{month_relation: :previous} = day) do diff --git a/lib/dotcom/body_tag.ex b/lib/dotcom/body_tag.ex index 90b7c0f562..27c473b4c6 100644 --- a/lib/dotcom/body_tag.ex +++ b/lib/dotcom/body_tag.ex @@ -9,7 +9,7 @@ defmodule Dotcom.BodyTag do UI elements. """ - alias Phoenix.HTML.Tag + alias PhoenixHTMLHelpers.Tag @spec render(Plug.Conn.t()) :: Phoenix.HTML.Safe.t() def render(conn) do diff --git a/lib/dotcom/components/buttons/button_group/arguments.ex b/lib/dotcom/components/buttons/button_group/arguments.ex index 8b2446426a..3589791fea 100644 --- a/lib/dotcom/components/buttons/button_group/arguments.ex +++ b/lib/dotcom/components/buttons/button_group/arguments.ex @@ -2,7 +2,7 @@ defmodule Dotcom.Components.Buttons.ButtonGroup do @moduledoc """ Convenience function for rendering a formatted list of links. Links should be passed as a list of [{text, href}]. The link text can either be a string, or a list of child elements - like what would be passed to Phoenix.HTML.Link. + like what would be passed to PhoenixHTMLHelpers.Link. """ defstruct class: "", id: nil, diff --git a/lib/dotcom/components/buttons/button_group/component.html.eex b/lib/dotcom/components/buttons/button_group/component.html.eex index 57c38123e7..a19fd91b48 100644 --- a/lib/dotcom/components/buttons/button_group/component.html.eex +++ b/lib/dotcom/components/buttons/button_group/component.html.eex @@ -1,8 +1,7 @@ -<% alias Phoenix.HTML.{Tag, Link} %> -<%= Tag.content_tag :div, class: String.trim("button-group #{args.class}"), id: args.id do %> +<%= PhoenixHTMLHelpers.Tag.content_tag :div, class: String.trim("button-group #{args.class}"), id: args.id do %> <%= for {text, href} <- args.links do %> - <%= Tag.content_tag :div, class: "button-container" do %> - <%= Link.link(text, to: href, class: "btn button") %> + <%= PhoenixHTMLHelpers.Tag.content_tag :div, class: "button-container" do %> + <%= PhoenixHTMLHelpers.Link.link(text, to: href, class: "btn button") %> <% end %> <% end %> <% end %> diff --git a/lib/dotcom/components/icons/svg_icon/arguments.ex b/lib/dotcom/components/icons/svg_icon/arguments.ex index c0887b997a..40fb6e673b 100644 --- a/lib/dotcom/components/icons/svg_icon/arguments.ex +++ b/lib/dotcom/components/icons/svg_icon/arguments.ex @@ -3,7 +3,7 @@ defmodule Dotcom.Components.Icons.SvgIcon do Deprecated, please add new svgs to the image directory in assets and use the site_web/views/helpers.ex "svg" method """ - alias Phoenix.HTML.Tag + alias PhoenixHTMLHelpers.Tag defstruct icon: :bus, class: "", show_tooltip?: true diff --git a/lib/dotcom/components/tabs/tab_selector/component.html.eex b/lib/dotcom/components/tabs/tab_selector/component.html.eex index f6e407cb7b..dca1fa7355 100644 --- a/lib/dotcom/components/tabs/tab_selector/component.html.eex +++ b/lib/dotcom/components/tabs/tab_selector/component.html.eex @@ -7,7 +7,7 @@ selected_class = if selected?(tab_item_name, args.selected), do: "tab-select-btn-selected", else: "" slug = slug(title) %> - <%= Phoenix.HTML.Link.link to: "#{href}\##{slug}", data: [scroll: "false"], id: slug, class: "btn #{selected_class}" do %> + <%= PhoenixHTMLHelpers.Link.link to: "#{href}\##{slug}", data: [scroll: "false"], id: slug, class: "btn #{selected_class}" do %> <%= if icon = args.icon_map[title] do %> <%= icon %> <% end %> diff --git a/lib/dotcom/content_rewriters/liquid_objects.ex b/lib/dotcom/content_rewriters/liquid_objects.ex index 0bac58ba03..6fb79e7710 100644 --- a/lib/dotcom/content_rewriters/liquid_objects.ex +++ b/lib/dotcom/content_rewriters/liquid_objects.ex @@ -8,7 +8,7 @@ defmodule Dotcom.ContentRewriters.LiquidObjects do """ import Phoenix.HTML, only: [raw: 1, safe_to_string: 1] - import Phoenix.HTML.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] import DotcomWeb.PartialView.SvgIconWithCircle, only: [svg_icon_with_circle: 1] import DotcomWeb.ViewHelpers, only: [fa: 1, svg: 1] diff --git a/lib/dotcom/schedule_note.ex b/lib/dotcom/schedule_note.ex index cce9757b2f..bdd91adc1a 100644 --- a/lib/dotcom/schedule_note.ex +++ b/lib/dotcom/schedule_note.ex @@ -3,8 +3,8 @@ defmodule Dotcom.ScheduleNote do Represents text describing the schedule for a subway route """ - import Phoenix.HTML.Tag - import Phoenix.HTML.Link + import PhoenixHTMLHelpers.Tag + import PhoenixHTMLHelpers.Link alias DotcomWeb.Router.Helpers alias Phoenix.HTML diff --git a/lib/dotcom/trip_plan/related_link.ex b/lib/dotcom/trip_plan/related_link.ex index 9b971244f8..ecf23e3a7b 100644 --- a/lib/dotcom/trip_plan/related_link.ex +++ b/lib/dotcom/trip_plan/related_link.ex @@ -6,7 +6,7 @@ defmodule Dotcom.TripPlan.RelatedLink do # Need a view in order to use the components. Ideally we'd have a separate # module, but that doesn't work at the moment. import DotcomWeb.Router.Helpers - import Phoenix.HTML.Link, only: [link: 2] + import PhoenixHTMLHelpers.Link, only: [link: 2] alias DotcomWeb.PartialView.SvgIconWithCircle alias Routes.Route diff --git a/lib/dotcom_web.ex b/lib/dotcom_web.ex index 79099303ae..17fa464b39 100644 --- a/lib/dotcom_web.ex +++ b/lib/dotcom_web.ex @@ -133,7 +133,9 @@ defmodule DotcomWeb do defp view_helpers do quote do # Use all HTML functionality (forms, tags, etc) - use Phoenix.HTML + import Phoenix.HTML + import PhoenixHTMLHelpers.Form + use PhoenixHTMLHelpers # Import LiveView and .heex helpers (live_render, live_patch, <.form>, etc) import Phoenix.LiveView.Helpers diff --git a/lib/dotcom_web/ambiguous_alert.ex b/lib/dotcom_web/ambiguous_alert.ex index deb2feb16e..fe196b3f8f 100644 --- a/lib/dotcom_web/ambiguous_alert.ex +++ b/lib/dotcom_web/ambiguous_alert.ex @@ -56,7 +56,7 @@ defimpl DotcomWeb.AmbiguousAlert, for: Alerts.Alert do active_periods |> Enum.map(fn {start_date, end_date} -> if start_date || end_date do - Phoenix.HTML.Tag.content_tag( + PhoenixHTMLHelpers.Tag.content_tag( :div, [ DotcomWeb.ViewHelpers.fa("calendar", class: "mr-025"), @@ -75,7 +75,7 @@ defimpl DotcomWeb.AmbiguousAlert, for: Alerts.Alert do defp date_tag(%DateTime{} = date) do with iso <- DateTime.to_iso8601(date), {:ok, readable} <- Timex.format(date, "{Mshort} {D} {YYYY} {h24}:{m}") do - Phoenix.HTML.Tag.content_tag(:time, readable, datetime: iso) + PhoenixHTMLHelpers.Tag.content_tag(:time, readable, datetime: iso) end end diff --git a/lib/dotcom_web/controllers/mode/bus.ex b/lib/dotcom_web/controllers/mode/bus.ex index 9fff32e816..93078b6ee3 100644 --- a/lib/dotcom_web/controllers/mode/bus.ex +++ b/lib/dotcom_web/controllers/mode/bus.ex @@ -4,7 +4,7 @@ defmodule DotcomWeb.Mode.BusController do "Schedule information for MBTA bus routes in the Greater Boston region, " <> "including real-time updates and arrival predictions." - import Phoenix.HTML.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] import Phoenix.HTML, only: [safe_to_string: 1] def route_type, do: 3 diff --git a/lib/dotcom_web/controllers/mode/commuter.ex b/lib/dotcom_web/controllers/mode/commuter.ex index b6186d7260..c24bef8715 100644 --- a/lib/dotcom_web/controllers/mode/commuter.ex +++ b/lib/dotcom_web/controllers/mode/commuter.ex @@ -4,7 +4,7 @@ defmodule DotcomWeb.Mode.CommuterRailController do "Schedule information for MBTA Commuter Rail lines in the Greater Boston region, " <> "including real-time updates and arrival predictions." - import Phoenix.HTML.Link, only: [link: 2] + import PhoenixHTMLHelpers.Link, only: [link: 2] def route_type, do: 2 diff --git a/lib/dotcom_web/templates/alert/_t-alerts.html.eex b/lib/dotcom_web/templates/alert/_t-alerts.html.eex index d9e2f524ce..695dc0e9bf 100644 --- a/lib/dotcom_web/templates/alert/_t-alerts.html.eex +++ b/lib/dotcom_web/templates/alert/_t-alerts.html.eex @@ -7,7 +7,7 @@ Sign in
- <%= DotcomWeb.Endpoint |> static_url("/images/t-alerts-phone.png") |> Phoenix.HTML.Tag.img_tag() %> + <%= DotcomWeb.Endpoint |> static_url("/images/t-alerts-phone.png") |> PhoenixHTMLHelpers.Tag.img_tag() %>
diff --git a/lib/dotcom_web/templates/partial/_search_input.html.eex b/lib/dotcom_web/templates/partial/_search_input.html.eex index ed31ec654f..56ebad923d 100644 --- a/lib/dotcom_web/templates/partial/_search_input.html.eex +++ b/lib/dotcom_web/templates/partial/_search_input.html.eex @@ -12,7 +12,7 @@ %>
- <%= Phoenix.HTML.Form.text_input( + <%= PhoenixHTMLHelpers.Form.text_input( Map.get(assigns, :form, :query), Map.get(assigns, :field, :input), id: "search-#{@prefix}__input", diff --git a/lib/dotcom_web/views/alert_view.ex b/lib/dotcom_web/views/alert_view.ex index 4d7efe7206..bc835423c6 100644 --- a/lib/dotcom_web/views/alert_view.ex +++ b/lib/dotcom_web/views/alert_view.ex @@ -4,7 +4,7 @@ defmodule DotcomWeb.AlertView do use DotcomWeb, :view import DotcomWeb.ViewHelpers - import Phoenix.HTML.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] import DotcomWeb.PartialView.SvgIconWithCircle, only: [svg_icon_with_circle: 1] alias Alerts.{Alert, InformedEntity, InformedEntitySet, URLParsingHelpers} diff --git a/lib/dotcom_web/views/customer_support_view.ex b/lib/dotcom_web/views/customer_support_view.ex index 695d0af0ff..cde4759003 100644 --- a/lib/dotcom_web/views/customer_support_view.ex +++ b/lib/dotcom_web/views/customer_support_view.ex @@ -4,7 +4,7 @@ defmodule DotcomWeb.CustomerSupportView do """ use DotcomWeb, :view alias Routes.Route - import Phoenix.HTML.Tag, only: [content_tag: 2, content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 2, content_tag: 3] alias Feedback.Message diff --git a/lib/dotcom_web/views/date_time_selector.ex b/lib/dotcom_web/views/date_time_selector.ex index 0b10f94203..28f6ca9f12 100644 --- a/lib/dotcom_web/views/date_time_selector.ex +++ b/lib/dotcom_web/views/date_time_selector.ex @@ -3,7 +3,7 @@ defmodule DateTimeSelector do use DotcomWeb, :view - import Phoenix.HTML.Tag + import PhoenixHTMLHelpers.Tag alias DotcomWeb.PartialView.SvgIconWithCircle alias Phoenix.{HTML.Form} diff --git a/lib/dotcom_web/views/error_helpers.ex b/lib/dotcom_web/views/error_helpers.ex index c00db7efec..4561a7eca5 100644 --- a/lib/dotcom_web/views/error_helpers.ex +++ b/lib/dotcom_web/views/error_helpers.ex @@ -3,7 +3,7 @@ defmodule DotcomWeb.ErrorHelpers do Conveniences for translating and building error messages. """ - use Phoenix.HTML + use PhoenixHTMLHelpers @doc """ Generates tag for inlined form input errors. diff --git a/lib/dotcom_web/views/event_view.ex b/lib/dotcom_web/views/event_view.ex index 944c104b72..217deefb2f 100644 --- a/lib/dotcom_web/views/event_view.ex +++ b/lib/dotcom_web/views/event_view.ex @@ -2,7 +2,7 @@ defmodule DotcomWeb.EventView do @moduledoc "Module to display fields on the events view" use DotcomWeb, :view - import Phoenix.HTML.Link + import PhoenixHTMLHelpers.Link import Dotcom.FontAwesomeHelpers diff --git a/lib/dotcom_web/views/fare_view.ex b/lib/dotcom_web/views/fare_view.ex index e03c2dd820..a6659355bf 100644 --- a/lib/dotcom_web/views/fare_view.ex +++ b/lib/dotcom_web/views/fare_view.ex @@ -4,8 +4,6 @@ defmodule DotcomWeb.FareView do """ use DotcomWeb, :view - alias CMS.Field.Link - alias CMS.Partial.Paragraph.{ Description, DescriptionList diff --git a/lib/dotcom_web/views/helpers.ex b/lib/dotcom_web/views/helpers.ex index 0ae7f8b429..b58ae8f9ac 100644 --- a/lib/dotcom_web/views/helpers.ex +++ b/lib/dotcom_web/views/helpers.ex @@ -8,8 +8,8 @@ defmodule DotcomWeb.ViewHelpers do import Dotcom.ContentRewriters.LiquidObjects.Fare, only: [fare_object_request: 1] import DotcomWeb.Router.Helpers, only: [redirect_path: 3, stop_path: 3] import Phoenix.HTML, only: [raw: 1] - import Phoenix.HTML.Link, only: [link: 2] - import Phoenix.HTML.Tag, only: [content_tag: 2, content_tag: 3, tag: 2] + import PhoenixHTMLHelpers.Link, only: [link: 2] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 2, content_tag: 3, tag: 2] import Plug.Conn alias Phoenix.HTML.Safe diff --git a/lib/dotcom_web/views/helpers/cms_helpers.ex b/lib/dotcom_web/views/helpers/cms_helpers.ex index 40b50650bb..279c142a2e 100644 --- a/lib/dotcom_web/views/helpers/cms_helpers.ex +++ b/lib/dotcom_web/views/helpers/cms_helpers.ex @@ -5,7 +5,7 @@ defmodule DotcomWeb.CMSHelpers do import DotcomWeb.ViewHelpers, only: [route_to_class: 1] import CSSHelpers, only: [string_to_class: 1] - import Phoenix.HTML.Link + import PhoenixHTMLHelpers.Link alias CMS.API alias Routes.{Repo, Route} diff --git a/lib/dotcom_web/views/helpers/search_helpers.ex b/lib/dotcom_web/views/helpers/search_helpers.ex index 89cddc887b..a206058618 100644 --- a/lib/dotcom_web/views/helpers/search_helpers.ex +++ b/lib/dotcom_web/views/helpers/search_helpers.ex @@ -1,6 +1,6 @@ defmodule DotcomWeb.SearchHelpers do - import Phoenix.HTML.Tag, only: [content_tag: 3] - import Phoenix.HTML.Form, only: [form_for: 4, search_input: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Form, only: [form_for: 4, search_input: 3] import DotcomWeb.Router.Helpers, only: [search_path: 2] @form_options [as: :search, method: :get] diff --git a/lib/dotcom_web/views/page_view.ex b/lib/dotcom_web/views/page_view.ex index 1b1960dfc6..ff73280029 100644 --- a/lib/dotcom_web/views/page_view.ex +++ b/lib/dotcom_web/views/page_view.ex @@ -1,6 +1,6 @@ defmodule DotcomWeb.PageView do @moduledoc false - import Phoenix.HTML.Tag + import PhoenixHTMLHelpers.Tag import DotcomWeb.CMSHelpers import DotcomWeb.CMS.ParagraphView, only: [render_paragraph: 2] diff --git a/lib/dotcom_web/views/partial/fullscreen_error.ex b/lib/dotcom_web/views/partial/fullscreen_error.ex index 0e767f711d..07b23c2c21 100644 --- a/lib/dotcom_web/views/partial/fullscreen_error.ex +++ b/lib/dotcom_web/views/partial/fullscreen_error.ex @@ -2,7 +2,7 @@ defmodule DotcomWeb.PartialView.FullscreenError do @moduledoc """ Struct for an error message that appears fullscreen. """ - import Phoenix.HTML.Tag, only: [content_tag: 2, content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 2, content_tag: 3] import DotcomWeb.ViewHelpers, only: [fa: 1] alias Phoenix.HTML diff --git a/lib/dotcom_web/views/partial/header_tabs.ex b/lib/dotcom_web/views/partial/header_tabs.ex index f736fb54db..cdbbe3038b 100644 --- a/lib/dotcom_web/views/partial/header_tabs.ex +++ b/lib/dotcom_web/views/partial/header_tabs.ex @@ -1,7 +1,7 @@ defmodule DotcomWeb.PartialView.HeaderTabs do use DotcomWeb, :view alias Phoenix.HTML - alias Phoenix.HTML.Link + alias PhoenixHTMLHelpers.Link alias DotcomWeb.PartialView.{HeaderTab, HeaderTabBadge} @spec render_tabs([HeaderTab.t()], Keyword.t()) :: HTML.safe() diff --git a/lib/dotcom_web/views/partial/svg_icon_with_circle.ex b/lib/dotcom_web/views/partial/svg_icon_with_circle.ex index c788b41609..d54aca8058 100644 --- a/lib/dotcom_web/views/partial/svg_icon_with_circle.ex +++ b/lib/dotcom_web/views/partial/svg_icon_with_circle.ex @@ -1,7 +1,7 @@ defmodule DotcomWeb.PartialView.SvgIconWithCircle do alias Dotcom.Components.Icons.SvgIcon alias DotcomWeb.ViewHelpers - alias Phoenix.HTML.Tag + alias PhoenixHTMLHelpers.Tag alias Routes.Route defstruct icon: nil, diff --git a/lib/dotcom_web/views/schedule/timetable.ex b/lib/dotcom_web/views/schedule/timetable.ex index ad69933a3b..f462b5aa94 100644 --- a/lib/dotcom_web/views/schedule/timetable.ex +++ b/lib/dotcom_web/views/schedule/timetable.ex @@ -3,7 +3,7 @@ defmodule DotcomWeb.ScheduleView.Timetable do Functions for showing timetable content. """ - import Phoenix.HTML.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] alias DotcomWeb.PartialView.SvgIconWithCircle alias DotcomWeb.ViewHelpers, as: Helpers diff --git a/lib/dotcom_web/views/search_view.ex b/lib/dotcom_web/views/search_view.ex index 2132006b27..a691d93005 100644 --- a/lib/dotcom_web/views/search_view.ex +++ b/lib/dotcom_web/views/search_view.ex @@ -18,7 +18,7 @@ defmodule DotcomWeb.SearchView do defdelegate fa_icon_for_file_type(mime), to: Dotcom.FontAwesomeHelpers - @spec render_filter_option(Phoenix.HTML.Form, atom, map) :: Phoenix.HTML.safe() + @spec render_filter_option(PhoenixHTMLHelpers.Form, atom, map) :: Phoenix.HTML.safe() def render_filter_option(form, type, option) do id = "#{type}_#{option.value}" name = "search[#{type}][#{option.value}]" diff --git a/lib/dotcom_web/views/trip_plan_view.ex b/lib/dotcom_web/views/trip_plan_view.ex index b41a89f195..78a0e1d02d 100644 --- a/lib/dotcom_web/views/trip_plan_view.ex +++ b/lib/dotcom_web/views/trip_plan_view.ex @@ -4,7 +4,6 @@ defmodule DotcomWeb.TripPlanView do use DotcomWeb, :view require Routes.Route alias Fares.{Fare, Format} - alias Phoenix.{HTML} alias Routes.Route alias Dotcom.TripPlan.{ItineraryRow, Query} alias DotcomWeb.PartialView.SvgIconWithCircle @@ -434,11 +433,13 @@ defmodule DotcomWeb.TripPlanView do defp transfer_note_text(nil), do: nil defp transfer_note_text(_) do - HTML.Tag.content_tag( + PhoenixHTMLHelpers.Tag.content_tag( :span, [ "Total may be less with ", - HTML.Tag.content_tag(:a, "transfers", href: "https://www.mbta.com/fares/transfers") + PhoenixHTMLHelpers.Tag.content_tag(:a, "transfers", + href: "https://www.mbta.com/fares/transfers" + ) ] ) end @@ -450,7 +451,7 @@ defmodule DotcomWeb.TripPlanView do defp transfer_note_calculator_text(nil), do: nil defp transfer_note_calculator_text(_) do - HTML.Tag.content_tag( + PhoenixHTMLHelpers.Tag.content_tag( :span, [ "Total Fare Estimate*" @@ -459,7 +460,7 @@ defmodule DotcomWeb.TripPlanView do end def render_to_string(template, data) do - template |> render(data) |> HTML.safe_to_string() + template |> render(data) |> Phoenix.HTML.safe_to_string() end def itinerary_map(map_data) do @@ -487,7 +488,7 @@ defmodule DotcomWeb.TripPlanView do itinerary_row_list: itinerary_row_list ) - access_html = i |> accessibility_icon() |> HTML.safe_to_string() + access_html = i |> accessibility_icon() |> Phoenix.HTML.safe_to_string() one_way_total_fare = get_one_way_total_by_type(i, :highest_one_way_fare) diff --git a/lib/journey.ex b/lib/journey.ex index d6d77c8410..359e22e81f 100644 --- a/lib/journey.ex +++ b/lib/journey.ex @@ -2,7 +2,7 @@ defmodule Journey do @moduledoc """ Represents a schedule at a stop (origin or destination) or a pair of stops (origin and destination) """ - alias Phoenix.HTML.Tag + alias PhoenixHTMLHelpers.Tag alias Predictions.Prediction alias Schedules.{Schedule, Trip} diff --git a/lib/util/breadcrumb_html.ex b/lib/util/breadcrumb_html.ex index ba75bdd80e..072fc07ebd 100644 --- a/lib/util/breadcrumb_html.ex +++ b/lib/util/breadcrumb_html.ex @@ -1,7 +1,7 @@ defmodule Util.BreadcrumbHTML do import Phoenix.HTML, only: [raw: 1] - alias Phoenix.HTML.Link + alias PhoenixHTMLHelpers.Link @spec breadcrumb_trail(Plug.Conn.t()) :: Phoenix.HTML.safe() def breadcrumb_trail(%Plug.Conn{assigns: %{breadcrumbs: []}}), do: raw("") diff --git a/mix.exs b/mix.exs index cefb8d07a3..8b748628ef 100644 --- a/mix.exs +++ b/mix.exs @@ -114,8 +114,7 @@ defmodule DotCom.Mixfile do # latest version 1.7.14 {:phoenix, "~> 1.7"}, {:phoenix_ecto, "4.6.2"}, - # latest version 4.1.1; cannot upgrade because we use Phoenix.HTML - {:phoenix_html, "3.3.3"}, + {:phoenix_html_helpers, "1.0.1"}, {:phoenix_live_dashboard, "0.8.4"}, {:phoenix_live_reload, "1.5.3", [only: :dev]}, # currently release candidate, but used in Phoenix 1.7 generator: https://github.com/phoenix-diff/phoenix-diff/blob/f320791d24bc3248fbdde557978235829313aa06/priv/data/sample-app/1.7.14/default/mix.exs#L42 diff --git a/mix.lock b/mix.lock index 3fd15d2495..a725bb301c 100644 --- a/mix.lock +++ b/mix.lock @@ -72,7 +72,8 @@ "parse_trans": {:hex, :parse_trans, "3.4.1", "6e6aa8167cb44cc8f39441d05193be6e6f4e7c2946cb2759f015f8c56b76e5ff", [:rebar3], [], "hexpm", "620a406ce75dada827b82e453c19cf06776be266f5a67cff34e1ef2cbb60e49a"}, "phoenix": {:hex, :phoenix, "1.7.14", "a7d0b3f1bc95987044ddada111e77bd7f75646a08518942c72a8440278ae7825", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.14", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.7", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2 or ~> 2.0", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}, {:websock_adapter, "~> 0.5.3", [hex: :websock_adapter, repo: "hexpm", optional: false]}], "hexpm", "c7859bc56cc5dfef19ecfc240775dae358cbaa530231118a9e014df392ace61a"}, "phoenix_ecto": {:hex, :phoenix_ecto, "4.6.2", "3b83b24ab5a2eb071a20372f740d7118767c272db386831b2e77638c4dcc606d", [:mix], [{:ecto, "~> 3.5", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0 or ~> 4.1", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.16 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}], "hexpm", "3f94d025f59de86be00f5f8c5dd7b5965a3298458d21ab1c328488be3b5fcd59"}, - "phoenix_html": {:hex, :phoenix_html, "3.3.3", "380b8fb45912b5638d2f1d925a3771b4516b9a78587249cabe394e0a5d579dc9", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "923ebe6fec6e2e3b3e569dfbdc6560de932cd54b000ada0208b5f45024bdd76c"}, + "phoenix_html": {:hex, :phoenix_html, "4.1.1", "4c064fd3873d12ebb1388425a8f2a19348cef56e7289e1998e2d2fa758aa982e", [:mix], [], "hexpm", "f2f2df5a72bc9a2f510b21497fd7d2b86d932ec0598f0210fed4114adc546c6f"}, + "phoenix_html_helpers": {:hex, :phoenix_html_helpers, "1.0.1", "7eed85c52eff80a179391036931791ee5d2f713d76a81d0d2c6ebafe1e11e5ec", [:mix], [{:phoenix_html, "~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "cffd2385d1fa4f78b04432df69ab8da63dc5cf63e07b713a4dcf36a3740e3090"}, "phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.8.4", "4508e481f791ce62ec6a096e13b061387158cbeefacca68c6c1928e1305e23ed", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.5", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:ecto_sqlite3_extras, "~> 1.1.7 or ~> 1.2.0", [hex: :ecto_sqlite3_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.19 or ~> 1.0", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6 or ~> 1.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "2984aae96994fbc5c61795a73b8fb58153b41ff934019cfb522343d2d3817d59"}, "phoenix_live_reload": {:hex, :phoenix_live_reload, "1.5.3", "f2161c207fda0e4fb55165f650f7f8db23f02b29e3bff00ff7ef161d6ac1f09d", [:mix], [{:file_system, "~> 0.3 or ~> 1.0", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "b4ec9cd73cb01ff1bd1cac92e045d13e7030330b74164297d1aee3907b54803c"}, "phoenix_live_view": {:hex, :phoenix_live_view, "1.0.0-rc.6", "47d2669995ea326e5c71f5c1bc9177109cebf211385c638faa7b5862a401e516", [:mix], [{:floki, "~> 0.36", [hex: :floki, repo: "hexpm", optional: true]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix, "~> 1.6.15 or ~> 1.7.0", [hex: :phoenix, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 3.3 or ~> 4.0", [hex: :phoenix_html, repo: "hexpm", optional: false]}, {:phoenix_template, "~> 1.0", [hex: :phoenix_template, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: true]}, {:plug, "~> 1.15", [hex: :plug, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.2 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "e56e4f1642a0b20edc2488cab30e5439595e0d8b5b259f76ef98b1c4e2e5b527"}, diff --git a/test/dotcom_web/views/helpers_test.exs b/test/dotcom_web/views/helpers_test.exs index 764a41d1ee..9aa8106303 100644 --- a/test/dotcom_web/views/helpers_test.exs +++ b/test/dotcom_web/views/helpers_test.exs @@ -3,7 +3,7 @@ defmodule DotcomWeb.ViewHelpersTest do use DotcomWeb.ConnCase, async: true import DotcomWeb.ViewHelpers - import Phoenix.HTML.Tag, only: [tag: 2, content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [tag: 2, content_tag: 3] import Phoenix.HTML, only: [safe_to_string: 1, html_escape: 1] alias Routes.{Repo, Route} diff --git a/test/dotcom_web/views/schedule_view_test.exs b/test/dotcom_web/views/schedule_view_test.exs index 0d9adb6abc..f6ef6c3eea 100644 --- a/test/dotcom_web/views/schedule_view_test.exs +++ b/test/dotcom_web/views/schedule_view_test.exs @@ -7,7 +7,7 @@ defmodule DotcomWeb.ScheduleViewTest do import DotcomWeb.ScheduleView import Mox - import Phoenix.HTML.Tag, only: [content_tag: 3] + import PhoenixHTMLHelpers.Tag, only: [content_tag: 3] import Phoenix.HTML, only: [safe_to_string: 1] setup :verify_on_exit!