Merge branch 'fix-date-helpers' into 'master'

fix: Make styled inputs work correctly

See merge request mythic-insight/legendary!127
This commit is contained in:
Robert Prehn 2021-09-17 16:50:50 +00:00
commit 653d825904

View file

@ -48,7 +48,7 @@ defmodule Legendary.CoreWeb.Helpers do
{type, rest_opts} = Keyword.pop(opts, :type, input_type(f, field))
{classes, rest_opts} = Keyword.pop(rest_opts, :class, default_classes_for_type(type))
{label_text, rest_opts} = Keyword.pop(rest_opts, :label)
{input_helper, _rest_opts} = Keyword.pop(rest_opts, :input_helper, type)
{input_helper, _rest_opts} = Keyword.pop(rest_opts, :input_helper, input_type(f, field))
error_classes =
if Keyword.get_values(f.errors, field) |> Enum.any?() do
@ -103,7 +103,7 @@ defmodule Legendary.CoreWeb.Helpers do
~E"""
<%= content_tag :div, class: Enum.join([classes, error_classes], " ") do %>
<%= apply(Phoenix.HTML.Form, input_helper, [f, field, rest_opts ++ child_opts]) %>
<%= apply(Phoenix.HTML.Form, type, [f, field, rest_opts ++ child_opts]) %>
<% end %>
"""
end