chore: Fix a variety of warnings
This commit is contained in:
parent
b11e23b35c
commit
be2c1cb1b9
11 changed files with 20 additions and 30 deletions
|
@ -11,7 +11,7 @@ defmodule Admin.ErrorHelpersTest do
|
|||
|> form_for(
|
||||
"/example",
|
||||
as: :test_params,
|
||||
errors: [error_field: {"is an error", []}],
|
||||
errors: [error_field: {"is an error", []}]
|
||||
)
|
||||
end
|
||||
|
||||
|
|
|
@ -14,12 +14,6 @@ defmodule AppWeb.Router do
|
|||
plug :accepts, ["json"]
|
||||
end
|
||||
|
||||
scope "/", AppWeb do
|
||||
pipe_through :browser
|
||||
|
||||
get "/", PageController, :index
|
||||
end
|
||||
|
||||
# Other scopes may use custom stacks.
|
||||
# scope "/api", AppWeb do
|
||||
# pipe_through :api
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Please use the following link to confirm your e-mail address:
|
||||
<% end %>
|
||||
|
||||
<%= CoreWeb.EmailHelpers.button href: @url do %>
|
||||
<%= styled_button href: @url do %>
|
||||
Confirm my email address
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
Please use the following link to reset your password:
|
||||
<% end %>
|
||||
|
||||
<%= CoreWeb.EmailHelpers.button href: @url do %>
|
||||
<%= styled_button href: @url do %>
|
||||
Reset my password
|
||||
<% end %>
|
||||
|
||||
|
|
|
@ -4,6 +4,6 @@ defmodule AuthWeb.EmailView do
|
|||
namespace: AuthWeb,
|
||||
pattern: "**/*"
|
||||
|
||||
import CoreWeb.EmailHelpers
|
||||
import Phoenix.HTML, only: [raw: 1]
|
||||
import CoreWeb.EmailHelpers
|
||||
end
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
<div data-react-component="MenuEditor" data-react-props="<%= %{menu: @menu, posts: @posts, categories: @categories, id: @id} |> Phoenix.json_library().encode!() |> Base.encode64() %>">
|
||||
</div>
|
||||
|
||||
<%= form_for @conn, Routes.menus_path(@conn, :update, @id), [method: :put], fn _f -> %>
|
||||
<% end %>
|
|
@ -1,8 +1,6 @@
|
|||
defmodule Content.LayoutView do
|
||||
use Content, :view
|
||||
|
||||
alias Content.{Option, Options}
|
||||
|
||||
def title(Content.PostsView, "index.html", assigns) do
|
||||
"Page #{assigns.page} | #{title(nil, nil, nil)}"
|
||||
end
|
||||
|
|
|
@ -158,8 +158,9 @@ defmodule CoreWeb.EmailHelpers do
|
|||
"""
|
||||
end
|
||||
|
||||
@spec col(number, keyword, [{:do, any}, ...]) :: {:safe, [...]}
|
||||
def col(n, opts, do: content) do
|
||||
{of, opts} = Keyword.pop!(opts, :of)
|
||||
{of, _opts} = Keyword.pop!(opts, :of)
|
||||
width = n * 100.0 / of
|
||||
|
||||
~E"""
|
||||
|
@ -225,6 +226,8 @@ defmodule CoreWeb.EmailHelpers do
|
|||
"""
|
||||
end
|
||||
|
||||
def styled_button(opts, do: content), do: button(opts, do: content)
|
||||
|
||||
def button(opts, do: content) do
|
||||
{overrides, opts_without_style} = Keyword.pop(opts, :style, %{})
|
||||
{href, _rest_opts} = Keyword.pop!(opts_without_style, :href)
|
||||
|
@ -285,9 +288,10 @@ defmodule CoreWeb.EmailHelpers do
|
|||
end
|
||||
|
||||
defp li_for_ul(index, list_length, content) do
|
||||
last_styles = if index == list_length - 1, do: map_style(effective_styles(:last_li))
|
||||
style_type = if index == list_length - 1, do: :last_li, else: :li
|
||||
|
||||
~E"""
|
||||
<li style="<%= map_style(effective_styles(:li)) %>">
|
||||
<li style="<%= map_style(effective_styles(style_type)) %>">
|
||||
<%= content %>
|
||||
</li>
|
||||
"""
|
||||
|
|
|
@ -4,25 +4,24 @@ defmodule CoreWeb.ErrorHelpersTest do
|
|||
import CoreWeb.ErrorHelpers
|
||||
import Phoenix.HTML, only: [safe_to_string: 1]
|
||||
import Phoenix.HTML.Form, only: [form_for: 3]
|
||||
import Ecto.Changeset, only: [cast: 3, add_error: 3]
|
||||
|
||||
def form do
|
||||
:example
|
||||
|> form_for(
|
||||
"/example",
|
||||
as: :test_params,
|
||||
errors: [error_field: {"is an error", []}],
|
||||
errors: [error_field: {"is an error", []}]
|
||||
)
|
||||
end
|
||||
|
||||
test "error_class/2" do
|
||||
assert error_class(form, :error_field) == "error"
|
||||
assert error_class(form, :no_error_field) == ""
|
||||
assert error_class(form(), :error_field) == "error"
|
||||
assert error_class(form(), :no_error_field) == ""
|
||||
end
|
||||
|
||||
test "error_tag/3" do
|
||||
markup =
|
||||
form
|
||||
form()
|
||||
|> error_tag(:error_field, class: "foobar")
|
||||
|> Enum.at(0)
|
||||
|> safe_to_string()
|
||||
|
|
|
@ -12,7 +12,7 @@ defmodule CoreWeb.HelpersTest do
|
|||
|> form_for(
|
||||
"/example",
|
||||
as: :test_params,
|
||||
errors: [error_field: {"is an error", []}],
|
||||
errors: [error_field: {"is an error", []}]
|
||||
)
|
||||
end
|
||||
|
||||
|
@ -78,7 +78,7 @@ defmodule CoreWeb.HelpersTest do
|
|||
end
|
||||
|
||||
test "styled_input/4 (without error)" do
|
||||
markup = safe_to_string(styled_input(form, :no_error_field))
|
||||
markup = safe_to_string(styled_input(form(), :no_error_field))
|
||||
|
||||
assert markup =~ ~S{<div class="field "}
|
||||
assert markup =~ "<input"
|
||||
|
@ -86,7 +86,7 @@ defmodule CoreWeb.HelpersTest do
|
|||
end
|
||||
|
||||
test "styled_input/4 (with error)" do
|
||||
markup = safe_to_string(styled_input(form, :error_field))
|
||||
markup = safe_to_string(styled_input(form(), :error_field))
|
||||
|
||||
assert markup =~ ~S{<div class="field error"}
|
||||
assert markup =~ "<input"
|
||||
|
@ -99,7 +99,7 @@ defmodule CoreWeb.HelpersTest do
|
|||
options = [{"Test", 1}]
|
||||
|
||||
markup =
|
||||
styled_input(form, :no_error_field, config, options) do
|
||||
styled_input(form(), :no_error_field, config, options) do
|
||||
|
||||
end
|
||||
|> safe_to_string()
|
||||
|
|
|
@ -40,7 +40,7 @@ defmodule Mix.LegendaryTest do
|
|||
integer_array_input,
|
||||
array_input,
|
||||
other_input,
|
||||
] = inputs(schema)
|
||||
] = inputs(schema())
|
||||
|
||||
assert reference_input == nil
|
||||
assert integer_input =~ ~s(number_input)
|
||||
|
|
Loading…
Reference in a new issue