Compare commits

...

2 commits

Author SHA1 Message Date
Joao P Dubas 37a83ed2f2 fix: properly provide :songs to form 2023-11-22 01:39:03 +00:00
Joao P Dubas 7a638e345c fix: use <.link> to patch url 2023-11-22 01:36:53 +00:00
2 changed files with 14 additions and 7 deletions

View file

@ -517,15 +517,21 @@ defmodule LiveBeatsWeb.CoreComponents do
def button(%{patch: _} = assigns) do
~H"""
<%= if @primary do %>
<%= live_patch [to: @patch, class: "order-0 inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-purple-600 hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:order-1 sm:ml-3"] ++
Map.to_list(@rest) do %>
<.link
patch={@patch}
class="order-0 inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-purple-600 hover:bg-purple-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:order-1 sm:ml-3"
{@rest}
>
<%= render_slot(@inner_block) %>
<% end %>
</.link>
<% else %>
<%= live_patch [to: @patch, class: "order-1 inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:order-0 sm:ml-0 lg:ml-3"] ++
assigns_to_attributes(assigns, [:primary, :patch]) do %>
<.link
patch={@patch}
class="order-1 inline-flex items-center px-4 py-2 border border-gray-300 shadow-sm text-sm font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-purple-500 sm:order-0 sm:ml-0 lg:ml-3"
{@rest}
>
<%= render_slot(@inner_block) %>
<% end %>
</.link>
<% end %>
"""
end

View file

@ -2,7 +2,8 @@
<p class="inline text-gray-500 text-sm">(songs expire every six hours)</p>
<.form
for={:songs}
for={%{}}
as={:songs}
id="song-form"
class="space-y-8"
phx-target={@myself}