Fix Credo Design (AliasUsage): add aliases in lib
Add module aliases at top and use short names instead of fully qualified nested modules across lib/.
This commit is contained in:
parent
cfc8900c5c
commit
7a8b069834
25 changed files with 176 additions and 109 deletions
|
|
@ -29,6 +29,7 @@ defmodule MvWeb.CoreComponents do
|
|||
use Phoenix.Component
|
||||
use Gettext, backend: MvWeb.Gettext
|
||||
|
||||
alias Phoenix.HTML.Form, as: HTMLForm
|
||||
alias Phoenix.LiveView.JS
|
||||
|
||||
# WCAG 2.4.7 / 2.4.11: Shared focus ring for buttons and dropdown (trigger + items)
|
||||
|
|
@ -669,7 +670,7 @@ defmodule MvWeb.CoreComponents do
|
|||
def input(%{type: "checkbox"} = assigns) do
|
||||
assigns =
|
||||
assign_new(assigns, :checked, fn ->
|
||||
Phoenix.HTML.Form.normalize_value("checkbox", assigns[:value])
|
||||
HTMLForm.normalize_value("checkbox", assigns[:value])
|
||||
end)
|
||||
|
||||
# For checkboxes, we don't use HTML required attribute (means "must be checked")
|
||||
|
|
@ -736,7 +737,7 @@ defmodule MvWeb.CoreComponents do
|
|||
{@rest}
|
||||
>
|
||||
<option :if={@prompt} value="">{@prompt}</option>
|
||||
{Phoenix.HTML.Form.options_for_select(@options, @value)}
|
||||
{HTMLForm.options_for_select(@options, @value)}
|
||||
</select>
|
||||
</label>
|
||||
<.error :for={msg <- @errors}>{msg}</.error>
|
||||
|
|
@ -765,7 +766,7 @@ defmodule MvWeb.CoreComponents do
|
|||
@errors != [] && (@error_class || "textarea-error")
|
||||
]}
|
||||
{@rest}
|
||||
>{Phoenix.HTML.Form.normalize_value("textarea", @value)}</textarea>
|
||||
>{HTMLForm.normalize_value("textarea", @value)}</textarea>
|
||||
</label>
|
||||
<.error :for={msg <- @errors}>{msg}</.error>
|
||||
</fieldset>
|
||||
|
|
@ -790,7 +791,7 @@ defmodule MvWeb.CoreComponents do
|
|||
type={@type}
|
||||
name={@name}
|
||||
id={@id}
|
||||
value={Phoenix.HTML.Form.normalize_value(@type, @value)}
|
||||
value={HTMLForm.normalize_value(@type, @value)}
|
||||
class={[
|
||||
@class || "w-full input",
|
||||
@errors != [] && (@error_class || "input-error")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue