Complete Permissions for Groups, Membership Fees, and User Role Assignment closes #404 #405
1 changed files with 20 additions and 1 deletions
|
|
@ -545,6 +545,9 @@ defmodule MvWeb.CoreComponents do
|
||||||
attr :label, :string
|
attr :label, :string
|
||||||
attr :class, :string
|
attr :class, :string
|
||||||
attr :col_click, :any, doc: "optional column-specific click handler that overrides row_click"
|
attr :col_click, :any, doc: "optional column-specific click handler that overrides row_click"
|
||||||
|
|
||||||
|
attr :sort_field, :any,
|
||||||
|
doc: "optional; when equal to table sort_field, aria-sort is set on this th"
|
||||||
end
|
end
|
||||||
|
|
||||||
slot :action, doc: "the slot for showing user actions in the last table column"
|
slot :action, doc: "the slot for showing user actions in the last table column"
|
||||||
|
|
@ -560,7 +563,13 @@ defmodule MvWeb.CoreComponents do
|
||||||
<table class="table table-zebra">
|
<table class="table table-zebra">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th :for={col <- @col} class={Map.get(col, :class)}>{col[:label]}</th>
|
<th
|
||||||
|
:for={col <- @col}
|
||||||
|
class={Map.get(col, :class)}
|
||||||
|
aria-sort={table_th_aria_sort(col, @sort_field, @sort_order)}
|
||||||
|
>
|
||||||
|
{col[:label]}
|
||||||
|
</th>
|
||||||
<th :for={dyn_col <- @dynamic_cols}>
|
<th :for={dyn_col <- @dynamic_cols}>
|
||||||
<.live_component
|
<.live_component
|
||||||
module={MvWeb.Components.SortHeaderComponent}
|
module={MvWeb.Components.SortHeaderComponent}
|
||||||
|
|
@ -646,6 +655,16 @@ defmodule MvWeb.CoreComponents do
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|
||||||
|
defp table_th_aria_sort(col, sort_field, sort_order) do
|
||||||
|
col_sort = Map.get(col, :sort_field)
|
||||||
|
|
||||||
|
if not is_nil(col_sort) and col_sort == sort_field and sort_order in [:asc, :desc] do
|
||||||
|
if sort_order == :asc, do: "ascending", else: "descending"
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
@doc """
|
@doc """
|
||||||
Renders a data list.
|
Renders a data list.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue