diff --git a/demo/lib/demo_web/live/post_live.ex b/demo/lib/demo_web/live/post_live.ex index b1f3d486..c347fb1d 100644 --- a/demo/lib/demo_web/live/post_live.ex +++ b/demo/lib/demo_web/live/post_live.ex @@ -138,7 +138,12 @@ defmodule DemoWeb.PostLive do _assigns -> true end, - searchable: true + searchable: true, + render: fn assigns -> + ~H""" +

<%= Number.Delimit.number_to_delimited(@value, precision: 0, delimiter: ".") %>

+ """ + end }, user: %{ module: Backpex.Fields.BelongsTo, diff --git a/demo/lib/demo_web/live/product_live.ex b/demo/lib/demo_web/live/product_live.ex index 47544aff..15295410 100644 --- a/demo/lib/demo_web/live/product_live.ex +++ b/demo/lib/demo_web/live/product_live.ex @@ -73,6 +73,11 @@ defmodule DemoWeb.ProductLive do error -> error + end, + render: fn assigns -> + ~H""" +

<%= Number.Delimit.number_to_delimited(@value, precision: 0, delimiter: ".") %>

+ """ end }, price: %{ diff --git a/lib/backpex/html/html.ex b/lib/backpex/html/html.ex index c312c3c2..90304b18 100644 --- a/lib/backpex/html/html.ex +++ b/lib/backpex/html/html.ex @@ -15,7 +15,7 @@ defmodule Backpex.HTML do "—" iex> Backpex.HTML.pretty_value(1_000_000) - "1.000.000" + 1000000 iex> Backpex.HTML.pretty_value(1.11) 1.11 @@ -27,8 +27,5 @@ defmodule Backpex.HTML do def pretty_value(""), do: "—" - def pretty_value(input) when is_integer(input), - do: Number.Delimit.number_to_delimited(input, precision: 0, delimiter: ".") - def pretty_value(input), do: input end