Upgrading to v0.16

View Source

Bump Your Deps

Update Backpex to the latest version:

defp deps do
  [
    {:backpex, "~> 0.16.0"}
  ]
end

Refactoring of filter components

We have enhanced and refactored the filter components, introducing some breaking changes.

  • index_ prefix from filter component names has been removed
  • filter_badge/1 component has been moved to Backpex.HTML.Resource

Note that you will only be affected by these changes if you use filter components manually on custom pages.

Due to the refactoring of the filter components, there may be other unexpected errors, so we recommend looking into the changes of the PR in detail if you manually insert filter components to pages.

Backpex.Fields.Currency has been updated

The appearance of the currency field has changed completely. We now use a custom masked input instead of a number input which improves UX a lot. In addition we've removed the money dependency from Backpex so you can use whatever library you want to use for currencies in your app. The removal of money includes our custom Backpex.Ecto.AmountType ecto type.

If you used the money library before, these are the changes you have to make:

  1. Configure unit, unit_position, radix and thousands_separator for Backpex.Fields.Currency
def fields do
  [
    price: %{
      module: Backpex.Fields.Currency,
      label: "Price",
      unit: "€",
      unit_position: :after,
      radix: ",",
      thousands_separator: ".",
      symbol_space: true
    },
    ...
  ]
end

See field-specific options for default values.

  1. Configure defaults for money in your config/config.exs
config :money,
  default_currency: :EUR,
  separator: ".",
  delimiter: ",",
  symbol_on_right: true,
  symbol_space: true

The default values should ideally match the field options from step 1.

  1. Replace Backpex.Ecto.AmountType with Money.Ecto.Amount.Type
schema "products" do
  field :price, Money.Ecto.Amount.Type
  ...
end
  1. Add money dependency to your app
def deps do
  [
    {:money, "~> 1.14"},
    ...
  ]
end

Component changes

We've created a Backpex.HTML.CoreComponents.dropdown/1, which is now used for all Backpex dropdowns.