removed unnecessary @socket param to live_component in settings; removed now-unused icon_helpers
This commit is contained in:
parent
6b787297bb
commit
68d60c120d
3 changed files with 4 additions and 45 deletions
|
@ -105,9 +105,6 @@ defmodule Shift73kWeb do
|
||||||
# Import basic rendering functionality (render, render_layout, etc)
|
# Import basic rendering functionality (render, render_layout, etc)
|
||||||
import Phoenix.View
|
import Phoenix.View
|
||||||
|
|
||||||
# Import SVG Icon helper
|
|
||||||
import Shift73kWeb.IconHelpers
|
|
||||||
|
|
||||||
import Shift73kWeb.ErrorHelpers
|
import Shift73kWeb.ErrorHelpers
|
||||||
import Shift73kWeb.Gettext
|
import Shift73kWeb.Gettext
|
||||||
alias Shift73kWeb.Router.Helpers, as: Routes
|
alias Shift73kWeb.Router.Helpers, as: Routes
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<div class="row justify-content-center justify-content-md-start">
|
<div class="row justify-content-center justify-content-md-start">
|
||||||
<%= live_component @socket, Shift73kWeb.UserLive.Settings.Email, id: "email-#{@current_user.id}", current_user: @current_user %>
|
<%= live_component 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 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 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.CalendarUrl, id: "calendar_url-#{@current_user.id}", current_user: @current_user %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -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
|
|
Loading…
Reference in a new issue