From e7802850b934909b98e5e69247b2ac77d32729de Mon Sep 17 00:00:00 2001 From: zmagoD Date: Wed, 5 Aug 2020 22:56:54 +0200 Subject: [PATCH] add number input support --- lib/phoenix_bootstrap_form.ex | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/phoenix_bootstrap_form.ex b/lib/phoenix_bootstrap_form.ex index 0628b57..e8feb57 100644 --- a/lib/phoenix_bootstrap_form.ex +++ b/lib/phoenix_bootstrap_form.ex @@ -11,7 +11,7 @@ defmodule PhoenixBootstrapForm do draw_generic_input(:select, form, field, options, opts) end - [:text_input, :file_input, :email_input, :password_input, :textarea, :telephone_input] + [:text_input, :file_input, :email_input, :password_input, :textarea, :telephone_input, :number_input] |> Enum.each(fn method -> def unquote(method)(form = %Form{}, field, opts \\ []) when is_atom(field) do draw_generic_input(unquote(method), form, field, nil, opts) @@ -270,6 +270,10 @@ defmodule PhoenixBootstrapForm do Form.select(form, field, options, merge_css_classes(opts)) end + defp draw_input(:number_input, form, field, nil, opts) do + Form.number_input(form, field, merge_css_classes(opts)) + end + defp draw_input(type, form, field, nil, opts) do apply(Form, type, [form, field, merge_css_classes(opts)]) end