<%= for col <- @col do %>
-
+ |
<%= render_slot(col, row) %>
@@ -536,13 +624,16 @@ defmodule LiveBeatsWeb.LiveHelpers do
"""
end
+ attr :id, :any, required: true
+ attr :module, :atom, required: true
+ attr :row_id, :any, default: false
+ attr :rows, :list, required: true
+ attr :owns_profile?, :boolean, default: false
+ attr :active_id, :any, default: nil
+ # slots
+ attr :col, :list
def live_table(assigns) do
- assigns =
- assigns
- |> assign_new(:row_id, fn -> false end)
- |> assign_new(:active_id, fn -> nil end)
- |> assign_new(:owns_profile?, fn -> assigns.owns_profile? end)
- |> assign(:col, for(col <- assigns.col, col[:if] != false, do: col))
+ assigns = assign(assigns, :col, for(col <- assigns.col, col[:if] != false, do: col))
~H"""
@@ -551,8 +642,7 @@ defmodule LiveBeatsWeb.LiveHelpers do
<%= for col <- @col do %>
-
+ |
<%= col.label %>
|
<% end %>
@@ -563,10 +653,12 @@ defmodule LiveBeatsWeb.LiveHelpers do
<.live_component
module={@module}
id={@row_id.(row)}
- row={row} col={@col}
+ row={row}
+ col={@col}
index={i}
active_id={@active_id}
- class="hover:bg-gray-50",
+ class="hover:bg-gray-50"
+ ,
owns_profile?={@owns_profile?}
/>
<% end %>
@@ -595,8 +687,4 @@ defmodule LiveBeatsWeb.LiveHelpers do
|> JS.dispatch("js:focus-closest", to: to)
|> hide(to)
end
-
- defp assign_rest(assigns, exclude) do
- assign(assigns, :rest, assigns_to_attributes(assigns, exclude))
- end
end
diff --git a/lib/live_beats_web/views/layout_view.ex b/lib/live_beats_web/views/layout_view.ex
index 69fc6f8..dc0f98b 100644
--- a/lib/live_beats_web/views/layout_view.ex
+++ b/lib/live_beats_web/views/layout_view.ex
@@ -1,5 +1,6 @@
defmodule LiveBeatsWeb.LayoutView do
use LiveBeatsWeb, :view
+ use Phoenix.Component
# Phoenix LiveDashboard is available only in development by default,
# so we instruct Elixir to not warn if the dashboard route is missing.
@@ -69,7 +70,7 @@ defmodule LiveBeatsWeb.LayoutView do
def sidebar_account_dropdown(assigns) do
~H"""
- <.dropdown id={@id}>
+ <.dropdown id={@id} foo="bar">
<:img src={@current_user.avatar_url}/>
<:title><%= @current_user.name %>
<:subtitle>@<%= @current_user.username %>
diff --git a/mix.exs b/mix.exs
index 4790288..1720b66 100644
--- a/mix.exs
+++ b/mix.exs
@@ -7,7 +7,7 @@ defmodule LiveBeats.MixProject do
version: "0.1.0",
elixir: "~> 1.12",
elixirc_paths: elixirc_paths(Mix.env()),
- compilers: [:gettext] ++ Mix.compilers(),
+ compilers: [:gettext, :phoenix_live_view] ++ Mix.compilers(),
start_permanent: Mix.env() == :prod,
aliases: aliases(),
deps: deps()
@@ -40,7 +40,8 @@ defmodule LiveBeats.MixProject do
{:postgrex, ">= 0.0.0"},
{:phoenix_html, "~> 3.0"},
{:phoenix_live_reload, "~> 1.2", only: :dev},
- {:phoenix_live_view, github: "phoenixframework/phoenix_live_view", override: true},
+ # {:phoenix_live_view, github: "phoenixframework/phoenix_live_view", override: true},
+ {:phoenix_live_view, path: "~/oss/phoenix_live_view", override: true},
{:floki, ">= 0.30.0", only: :test},
{:phoenix_live_dashboard, "~> 0.6"},
{:esbuild, "~> 0.2", runtime: Mix.env() == :dev},
diff --git a/mix.lock b/mix.lock
index b88c34c..34ee1eb 100644
--- a/mix.lock
+++ b/mix.lock
@@ -22,12 +22,12 @@
"libcluster": {:hex, :libcluster, "3.3.1", "e7a4875cd1290cee7a693d6bd46076863e9e433708b01339783de6eff5b7f0aa", [:mix], [{:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "b575ca63c1cd84e01f3fa0fc45e6eb945c1ee7ae8d441d33def999075e9e5398"},
"mime": {:hex, :mime, "2.0.2", "0b9e1a4c840eafb68d820b0e2158ef5c49385d17fb36855ac6e7e087d4b1dcc5", [:mix], [], "hexpm", "e6a3f76b4c277739e36c2e21a2c640778ba4c3846189d5ab19f97f126df5f9b7"},
"mint": {:hex, :mint, "1.3.0", "396b3301102f7b775e103da5a20494b25753aed818d6d6f0ad222a3a018c3600", [:mix], [{:castore, "~> 0.1.0", [hex: :castore, repo: "hexpm", optional: true]}], "hexpm", "a9aac960562e43ca69a77e5176576abfa78b8398cec5543dd4fb4ab0131d5c1e"},
- "phoenix": {:git, "https://github.com/phoenixframework/phoenix.git", "ae2fb6bddd64fc7e3908ee6dd632f608254f532e", []},
+ "phoenix": {:git, "https://github.com/phoenixframework/phoenix.git", "c5bb03eee8ad802c125c92202ebec4e15c35c3e8", []},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.4.0", "0672ed4e4808b3fbed494dded89958e22fb882de47a97634c0b13e7b0b5f7720", [:mix], [{:ecto, "~> 3.3", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm", "09864e558ed31ee00bd48fcc1d4fc58ae9678c9e81649075431e69dbabb43cc1"},
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
"phoenix_live_dashboard": {:hex, :phoenix_live_dashboard, "0.6.2", "0769470265eb13af01b5001b29cb935f4710d6adaa1ffc18417a570a337a2f0f", [:mix], [{:ecto, "~> 3.6.2 or ~> 3.7", [hex: :ecto, repo: "hexpm", optional: true]}, {:ecto_mysql_extras, "~> 0.3", [hex: :ecto_mysql_extras, repo: "hexpm", optional: true]}, {:ecto_psql_extras, "~> 0.7", [hex: :ecto_psql_extras, repo: "hexpm", optional: true]}, {:mime, "~> 1.6 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:phoenix_live_view, "~> 0.17.1", [hex: :phoenix_live_view, repo: "hexpm", optional: false]}, {:telemetry_metrics, "~> 0.6.0", [hex: :telemetry_metrics, repo: "hexpm", optional: false]}], "hexpm", "5bc6c6b38a2ca8b5020b442322fcee6afd5e641637a0b1fb059d4bd89bc58e7b"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.3.3", "3a53772a6118d5679bf50fc1670505a290e32a1d195df9e069d8c53ab040c054", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm", "766796676e5f558dbae5d1bdb066849673e956005e3730dfd5affd7a6da4abac"},
- "phoenix_live_view": {:git, "https://github.com/phoenixframework/phoenix_live_view.git", "1ae64fb69b0951f2f67f01d369ec9a4006060001", []},
+ "phoenix_live_view": {:git, "https://github.com/phoenixframework/phoenix_live_view.git", "e24527536890be2f0565c4a6d122a89e819df58e", []},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},
"phoenix_view": {:hex, :phoenix_view, "1.0.0", "fea71ecaaed71178b26dd65c401607de5ec22e2e9ef141389c721b3f3d4d8011", [:mix], [{:phoenix_html, "~> 2.14.2 or ~> 3.0", [hex: :phoenix_html, repo: "hexpm", optional: true]}], "hexpm", "82be3e2516f5633220246e2e58181282c71640dab7afc04f70ad94253025db0c"},
"plug": {:hex, :plug, "1.13.4", "addb6e125347226e3b11489e23d22a60f7ab74786befb86c14f94fb5f23ca9a4", [:mix], [{:mime, "~> 1.0 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:plug_crypto, "~> 1.1.1 or ~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "06114c1f2a334212fe3ae567dbb3b1d29fd492c1a09783d52f3d489c1a6f4cf2"},
|