Merge branch 'main' into sidebar
Some checks reported errors
continuous-integration/drone/push Build encountered an error
Some checks reported errors
continuous-integration/drone/push Build encountered an error
This commit is contained in:
commit
bb6ea0085b
5 changed files with 44 additions and 45 deletions
|
|
@ -474,6 +474,7 @@ defmodule MvWeb.CoreComponents do
|
|||
|
||||
slot :col, required: true do
|
||||
attr :label, :string
|
||||
attr :col_click, :any, doc: "optional column-specific click handler that overrides row_click"
|
||||
end
|
||||
|
||||
slot :action, doc: "the slot for showing user actions in the last table column"
|
||||
|
|
@ -509,8 +510,11 @@ defmodule MvWeb.CoreComponents do
|
|||
<tr :for={row <- @rows} id={@row_id && @row_id.(row)}>
|
||||
<td
|
||||
:for={col <- @col}
|
||||
phx-click={@row_click && @row_click.(row)}
|
||||
class={["max-w-xs truncate", @row_click && "hover:cursor-pointer"]}
|
||||
phx-click={
|
||||
(col[:col_click] && col[:col_click].(@row_item.(row))) ||
|
||||
(@row_click && @row_click.(row))
|
||||
}
|
||||
class={["max-w-xs truncate", (col[:col_click] || @row_click) && "hover:cursor-pointer"]}
|
||||
>
|
||||
{render_slot(col, @row_item.(row))}
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue