Skip to content

Commit

Permalink
chore: remove StaticPageController (#2214)
Browse files Browse the repository at this point in the history
* location card was part of an older version of the stop page

* chore(DotcomWeb): remove some unused things

* chore: remove StaticPageController
  • Loading branch information
thecristen authored Nov 13, 2024
1 parent d8214d9 commit 8b3a82c
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 423 deletions.
19 changes: 0 additions & 19 deletions assets/css/_header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -430,22 +430,3 @@ nav.m-menu--mobile {
padding: unset;
width: 30px;
}

// /menu page
.m-menu--page {
margin-bottom: 4 * $base-spacing;

.m-menu__link {
padding-left: 0;
}

h3 {
line-height: 2;
margin-bottom: .5 * $base-spacing;
margin-top: $base-spacing;
}

hr {
margin: 0;
}
}
8 changes: 1 addition & 7 deletions lib/dotcom_web.ex
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ defmodule DotcomWeb do

def static_paths, do: ~w(css js fonts icon-svg images favicon robots.txt)

def model do
quote do
# Define common model functionality
end
end

def controller do
quote do
use Gettext, backend: DotcomWeb.Gettext
Expand Down Expand Up @@ -135,7 +129,7 @@ defmodule DotcomWeb do
use MbtaMetro

import DotcomWeb.{Components, ErrorHelpers}
import Phoenix.{HTML, LiveView.Helpers, View}
import Phoenix.{HTML, LiveView.Helpers}
import PhoenixHTMLHelpers.Form, except: [label: 1]
import PhoenixHTMLHelpers.{Format, Link, Tag}

Expand Down
5 changes: 5 additions & 0 deletions lib/dotcom_web/controllers/page_controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ defmodule DotcomWeb.PageController do
|> render("index.html")
end

def menu(conn, _params) do
conn
|> render("menu.html")
end

@spec fares(map) :: Paragraph.t() | nil
defp fares(query_params) do
case Repo.get_paragraph("paragraphs/multi-column/homepage-fares", query_params) do
Expand Down
35 changes: 0 additions & 35 deletions lib/dotcom_web/controllers/static_page.ex

This file was deleted.

24 changes: 0 additions & 24 deletions lib/dotcom_web/controllers/static_page_controller.ex

This file was deleted.

8 changes: 1 addition & 7 deletions lib/dotcom_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ defmodule DotcomWeb.Router do
end)
end

alias DotcomWeb.StaticPage

pipeline :secure do
if force_ssl = Application.compile_env(:dotcom, :secure_pipeline)[:force_ssl] do
plug(Plug.SSL, force_ssl)
Expand Down Expand Up @@ -144,6 +142,7 @@ defmodule DotcomWeb.Router do
get("/schedules/70A/*path_params", Redirector, to: "/betterbus-61-70-70A")

get("/", PageController, :index)
get("/menu", PageController, :menu)

get("/events", EventController, :index)
get("/events/icalendar/*path_params", EventController, :icalendar)
Expand Down Expand Up @@ -234,11 +233,6 @@ defmodule DotcomWeb.Router do
post("/search/query", SearchController, :query)
post("/search/click", SearchController, :click)
get("/bus-stop-changes", BusStopChangeController, :show)

for static_page <- StaticPage.static_pages() do
get("/#{StaticPage.convert_path(static_page)}", StaticPageController, static_page)
end

get("/vote", VoteController, :show)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/layout/_new_header.html.heex
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<a
class="font-white m-menu__toggle font-bold hidden-js"
data-nav="toggle-mobile-nav"
href={static_page_path(@conn, :menu)}
href={~p"/menu"}
>
Menu
</a>
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/layout/_new_nav_desktop.html.eex
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<nav id="navmenu-desktop" class="m-menu--desktop" aria-label="Main navigation">
<%= for %{menu_section: name, link: href, sub_menus: sub_menus} <- DotcomWeb.LayoutView.nav_link_content_redesign(@conn) do %>
<%= for %{menu_section: name, link: href, sub_menus: sub_menus} <- DotcomWeb.LayoutView.nav_link_content() do %>
<a class="m-menu--desktop__toggle"
href="<%= href %>"
data-nav="toggle-desktop-nav"
Expand Down
2 changes: 1 addition & 1 deletion lib/dotcom_web/templates/layout/_new_nav_mobile.html.heex
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<nav class="m-menu--mobile" id="navmenu" aria-label="Navigation Menu">
<div class="m-menu__content" data-nav="mobile-content">
<h1 class="m-menu__title text-3xl">Main Menu</h1>
<%= for {%{menu_section: menu_section, sub_menus: sub_menus}, index} <- Enum.with_index(nav_link_content_redesign(@conn)) do %>
<%= for {%{menu_section: menu_section, sub_menus: sub_menus}, index} <- Enum.with_index(nav_link_content()) do %>
<nav aria-labelledby={"section-heading-#{menu_section}"} class="m-menu__section">
<h2 id={"section-heading-#{menu_section}"} class="m-menu__section-heading">
<%= menu_section %>
Expand Down
24 changes: 24 additions & 0 deletions lib/dotcom_web/templates/page/menu.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<div class="container">
<h1>MBTA.com Menu</h1>
<hr class="m-0" />
<div
:for={
%{menu_section: menu_section, sub_menus: sub_menus} <-
DotcomWeb.LayoutView.nav_link_content()
}
class="page-section"
>
<h2 id={"#{menu_section}-section"}><%= menu_section %></h2>
<hr class="m-0" />
<section aria-labelledby={"#{menu_section}-section"} class="row">
<section
:for={%{links: links, sub_menu_section: section_name} <- sub_menus}
aria-labelledby={"#{section_name}-section"}
class="col-sm-4"
>
<h3 id={"#{section_name}-section"} class="font-small mt-6"><%= section_name %></h3>
<%= Enum.map(links, &DotcomWeb.LayoutView.render_nav_link/1) %>
</section>
</section>
</div>
</div>
7 changes: 0 additions & 7 deletions lib/dotcom_web/templates/static_page/_link.html.eex

This file was deleted.

35 changes: 0 additions & 35 deletions lib/dotcom_web/templates/static_page/about.html.eex

This file was deleted.

32 changes: 0 additions & 32 deletions lib/dotcom_web/templates/static_page/getting_around.html.eex

This file was deleted.

20 changes: 0 additions & 20 deletions lib/dotcom_web/templates/static_page/menu.html.eex

This file was deleted.

8 changes: 6 additions & 2 deletions lib/dotcom_web/views/fare_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,12 @@ defmodule DotcomWeb.FareView do

@spec do_summary_url(atom, String.t()) :: String.t()
defp do_summary_url(name, anchor \\ "") do
fare_path(DotcomWeb.Endpoint, :show, DotcomWeb.StaticPage.convert_path(name) <> "-fares") <>
anchor
name
|> Atom.to_string()
|> String.replace("_", "-")
|> then(fn name ->
fare_path(DotcomWeb.Endpoint, :show, name <> "-fares") <> anchor
end)
end

@spec fare_passes(Route.gtfs_route_type()) :: DescriptionList.t()
Expand Down
10 changes: 5 additions & 5 deletions lib/dotcom_web/views/layout_view.ex
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ defmodule DotcomWeb.LayoutView do
"#{module_class} #{template_class}"
end

def nav_link_content_redesign(conn),
def nav_link_content,
do: [
%{
menu_section: "Transit",
link: static_page_path(conn, :menu) <> "#Transit-section",
link: ~p"/menu#Transit-section",
sub_menus: [
%{
sub_menu_section: "Modes of Transit",
Expand Down Expand Up @@ -81,7 +81,7 @@ defmodule DotcomWeb.LayoutView do
},
%{
menu_section: "Fares",
link: static_page_path(conn, :menu) <> "#Fares-section",
link: ~p"/menu#Fares-section",
sub_menus: [
%{
sub_menu_section: "Fares Info",
Expand Down Expand Up @@ -117,7 +117,7 @@ defmodule DotcomWeb.LayoutView do
},
%{
menu_section: "Contact",
link: static_page_path(conn, :menu) <> "#Contact-section",
link: ~p"/menu#Contact-section",
sub_menus: [
%{
sub_menu_section: "Customer Support",
Expand Down Expand Up @@ -146,7 +146,7 @@ defmodule DotcomWeb.LayoutView do
},
%{
menu_section: "About",
link: static_page_path(conn, :menu) <> "#About-section",
link: ~p"/menu#About-section",
sub_menus: [
%{
sub_menu_section: "Get to Know Us",
Expand Down
Loading

0 comments on commit 8b3a82c

Please sign in to comment.