Skip to content

Commit

Permalink
Bump version to 4.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieuprog committed May 26, 2024
1 parent 51d8826 commit c4295c6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
13 changes: 12 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# Changelog

## 4.0.x

* Support `sort_param` and `drop_param` for list of embeds
* Add `PolymorphicEmbed.HTML.Component.polymorphic_embed_inputs_for/1`
(similar to `Phoenix.Component.inputs_for/1`)
* Support updating list of embeds while retaining ids
* Fix form input rendering for list of embeds
* Fix traverse_errors for nested embeds

**Breaking Change**: The form helper `get_polymorphic_type/3` has been updated to `get_polymorphic_type/2`.
The module name parameter (previously the second parameter) has been removed.

## 3.0.x

* Default value for polymorphic list of embeds is `[]` instead of `nil` (following `embeds_many/3`)
* Support Phoenix HTML 4.0
* Avoid compile-time dependencies between parent and polymorphic embedded schemas
* Support updating list of embeds while retaining ids

### Migration from 2.x to 3.x

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ You may use `polymorphic_embed_inputs_for/2` when working with LiveView.
<%= for channel_form <- polymorphic_embed_inputs_for f, :channel do %>
<%= hidden_inputs_for(channel_form) %>

<%= case get_polymorphic_type(f, Reminder, :channel) do %>
<%= case get_polymorphic_type(f, :channel) do %>
<% :sms -> %>
<%= label channel_form, :number %>
<%= text_input channel_form, :number %>
Expand All @@ -246,7 +246,7 @@ Using this function, you have to render the necessary hidden inputs manually as
### Get the type of a polymorphic embed

Sometimes you need to serialize the polymorphic embed and, once in the front-end, need to distinguish them.
`get_polymorphic_type/3` returns the type of the polymorphic embed:
`PolymorphicEmbed.get_polymorphic_type/3` returns the type of the polymorphic embed:

```elixir
PolymorphicEmbed.get_polymorphic_type(Reminder, :channel, SMS) == :sms
Expand All @@ -272,7 +272,7 @@ Add `polymorphic_embed` for Elixir as a dependency in your `mix.exs` file:
```elixir
def deps do
[
{:polymorphic_embed, "~> 3.0.7"}
{:polymorphic_embed, "~> 4.0.0"}
]
end
```
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule PolymorphicEmbed.MixProject do
use Mix.Project

@version "3.0.7"
@version "4.0.0"

def project do
[
Expand Down

0 comments on commit c4295c6

Please sign in to comment.