From 68d60c120dbbef8ed03da25a6b605ff875d672ed Mon Sep 17 00:00:00 2001 From: Adam Piontek Date: Sun, 14 Aug 2022 11:44:31 -0400 Subject: [PATCH] removed unnecessary @socket param to live_component in settings; removed now-unused icon_helpers --- lib/shift73k_web.ex | 3 -- lib/shift73k_web/live/user/settings.html.heex | 8 ++-- lib/shift73k_web/views/icon_helpers.ex | 38 ------------------- 3 files changed, 4 insertions(+), 45 deletions(-) delete mode 100644 lib/shift73k_web/views/icon_helpers.ex diff --git a/lib/shift73k_web.ex b/lib/shift73k_web.ex index 5a03df6a..0eaba35a 100644 --- a/lib/shift73k_web.ex +++ b/lib/shift73k_web.ex @@ -105,9 +105,6 @@ defmodule Shift73kWeb do # Import basic rendering functionality (render, render_layout, etc) import Phoenix.View - # Import SVG Icon helper - import Shift73kWeb.IconHelpers - import Shift73kWeb.ErrorHelpers import Shift73kWeb.Gettext alias Shift73kWeb.Router.Helpers, as: Routes diff --git a/lib/shift73k_web/live/user/settings.html.heex b/lib/shift73k_web/live/user/settings.html.heex index e45e8cee..40e08afe 100644 --- a/lib/shift73k_web/live/user/settings.html.heex +++ b/lib/shift73k_web/live/user/settings.html.heex @@ -6,10 +6,10 @@
- <%= live_component @socket, Shift73kWeb.UserLive.Settings.Email, id: "email-#{@current_user.id}", current_user: @current_user %> - <%= live_component @socket, Shift73kWeb.UserLive.Settings.Password, id: "password-#{@current_user.id}", current_user: @current_user %> - <%= live_component @socket, Shift73kWeb.UserLive.Settings.WeekStart, id: "week_start-#{@current_user.id}", current_user: @current_user %> - <%= live_component @socket, Shift73kWeb.UserLive.Settings.CalendarUrl, id: "calendar_url-#{@current_user.id}", current_user: @current_user %> + <%= live_component Shift73kWeb.UserLive.Settings.Email, id: "email-#{@current_user.id}", current_user: @current_user %> + <%= live_component Shift73kWeb.UserLive.Settings.Password, id: "password-#{@current_user.id}", current_user: @current_user %> + <%= live_component Shift73kWeb.UserLive.Settings.WeekStart, id: "week_start-#{@current_user.id}", current_user: @current_user %> + <%= live_component Shift73kWeb.UserLive.Settings.CalendarUrl, id: "calendar_url-#{@current_user.id}", current_user: @current_user %>
diff --git a/lib/shift73k_web/views/icon_helpers.ex b/lib/shift73k_web/views/icon_helpers.ex deleted file mode 100644 index 048373f8..00000000 --- a/lib/shift73k_web/views/icon_helpers.ex +++ /dev/null @@ -1,38 +0,0 @@ -defmodule Shift73kWeb.IconHelpers do - @moduledoc """ - Generate SVG sprite use tags for SVG icons - """ - - use Phoenix.HTML - alias Shift73kWeb.Router.Helpers, as: Routes - - def icon_div(conn, name, div_opts \\ [], svg_opts \\ []) do - content_tag(:div, tag_opts(name, div_opts)) do - icon_svg(conn, name, svg_opts) - end - end - - def icon_svg(conn, name, opts \\ []) do - opts = aria_hidden?(opts) - - content_tag(:svg, tag_opts(name, opts)) do - ~E""" - <%= if title = Keyword.get(opts, :aria_label), do: content_tag(:title, title) %> - <%= tag(:use, "xlink:href": Routes.static_path(conn, "/images/icons.svg##{name}")) %> - """ - end - end - - defp tag_opts(name, opts) do - Keyword.update(opts, :class, name, fn c -> "#{c} #{name}" end) - end - - defp aria_hidden?(opts) do - case Keyword.get(opts, :aria_hidden) do - "false" -> Keyword.drop(opts, [:aria_hidden]) - false -> Keyword.drop(opts, [:aria_hidden]) - "true" -> opts - _ -> Keyword.put(opts, :aria_hidden, "true") - end - end -end