Skip to content

Commit

Permalink
Merge pull request #12 from naymspace/feature/override-filter-functions
Browse files Browse the repository at this point in the history
Add ability to override `query/3` function in filters
  • Loading branch information
pehbehbeh authored Dec 8, 2023
2 parents 7c3970e + 08dad2e commit cebc260
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/backpex/filters/boolean.ex
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ defmodule Backpex.Filters.Boolean do
Enum.map(options(), fn %{predicate: p, key: k} -> {k, p} end)
|> Enum.into(%{})
end

defoverridable query: 3
end
end
end
2 changes: 2 additions & 0 deletions lib/backpex/filters/multi_select.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ defmodule Backpex.Filters.MultiSelect do
</div>
"""
end

defoverridable query: 3
end
end
end
2 changes: 2 additions & 0 deletions lib/backpex/filters/range.ex
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ defmodule Backpex.Filters.Range do
</div>
"""
end

defoverridable query: 3
end
end
end
2 changes: 2 additions & 0 deletions lib/backpex/filters/select.ex
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ defmodule Backpex.Filters.Select do

defp selected(""), do: nil
defp selected(value), do: value

defoverridable query: 3
end
end
end

0 comments on commit cebc260

Please sign in to comment.