diff --git a/lib/torch/views/filter_view.ex b/lib/torch/views/filter_view.ex index 707fad06..2a6268f5 100644 --- a/lib/torch/views/filter_view.ex +++ b/lib/torch/views/filter_view.ex @@ -109,11 +109,23 @@ defmodule Torch.FilterView do iex> params = %{"post" => %{"rating_equals" => 5}} ...> filter_number_input(:post, :rating, params) |> safe_to_string() "" + + iex> params = %{"post" => %{"rating_greater_than_or" => 15}} + ...> filter_number_input(:post, :rating, params) |> safe_to_string() + "" + + iex> params = %{"post" => %{"rating_greater_than" => 15}} + ...> filter_number_input(:post, :rating, params) |> safe_to_string() + "" + + iex> params = %{"post" => %{"rating_less_than" => 18}} + ...> filter_number_input(:post, :rating, params) |> safe_to_string() + "" """ @spec filter_number_input(prefix, field, map) :: Phoenix.HTML.safe() def filter_number_input(prefix, field, params) do prefix_str = to_string(prefix) - {name, value} = find_param(params[prefix_str], field, :number) + {name, value} = find_param(params[prefix_str], field, :number_select) text_input(prefix, String.to_atom(name), value: value, type: "number") end