Skip to content

Commit

Permalink
fix recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
woylie committed Dec 10, 2023
1 parent a0b5c98 commit 6e6fc66
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/doggo.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1169,22 +1169,6 @@ defmodule Doggo do
defp field_error_class([]), do: nil
defp field_error_class(_), do: "has-errors"

defp radio(%{option: {option_label, option_value}} = assigns) do
assigns
|> assign(label: option_label, option_value: option_value, option: nil)
|> radio()
end

defp radio(%{option: option_value} = assigns) do
assigns
|> assign(
label: Form.humanize(option_value),
option_value: option_value,
option: nil
)
|> radio()
end

defp radio(%{option_value: _} = assigns) do
~H"""
<.label>
Expand All @@ -1201,6 +1185,22 @@ defmodule Doggo do
"""
end

defp radio(%{option: {option_label, option_value}} = assigns) do
assigns
|> assign(label: option_label, option_value: option_value, option: nil)
|> radio()
end

defp radio(%{option: option_value} = assigns) do
assigns
|> assign(
label: Form.humanize(option_value),
option_value: option_value,
option: nil
)
|> radio()
end

defp checked?(option, value) when is_list(value) do
Phoenix.HTML.html_escape(option) in Enum.map(
value,
Expand Down

0 comments on commit 6e6fc66

Please sign in to comment.