style: highlight selected table and add tooltip
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
02af136fd9
commit
49fd2181a7
19 changed files with 687 additions and 151 deletions
|
|
@ -122,6 +122,7 @@ defmodule MvWeb.MemberLive.Index do
|
|||
|> assign(:groups, groups)
|
||||
|> assign(:boolean_custom_field_filters, %{})
|
||||
|> assign(:selected_members, MapSet.new())
|
||||
|> assign(:selected_member_id, nil)
|
||||
|> assign(:settings, settings)
|
||||
|> assign(:custom_fields_visible, custom_fields_visible)
|
||||
|> assign(:all_custom_fields, all_custom_fields)
|
||||
|
|
@ -160,6 +161,12 @@ defmodule MvWeb.MemberLive.Index do
|
|||
- `"select_all"` - Toggles selection of all visible members
|
||||
- `"sort"` - Sort event from SortHeaderComponent. Updates sort field/order and syncs URL
|
||||
"""
|
||||
@impl true
|
||||
def handle_event("select_row_and_navigate", %{"id" => id}, socket) do
|
||||
# Navigate to member show. Back button on show page uses ?highlight=id so returning to index shows row as selected.
|
||||
{:noreply, push_navigate(socket, to: ~p"/members/#{id}")}
|
||||
end
|
||||
|
||||
@impl true
|
||||
def handle_event("select_member", %{"id" => id}, socket) do
|
||||
selected =
|
||||
|
|
@ -599,6 +606,7 @@ defmodule MvWeb.MemberLive.Index do
|
|||
|> assign(:member_fields_visible_db, visible_member_fields_db)
|
||||
|> assign(:member_fields_visible_computed, visible_member_fields_computed)
|
||||
|> assign(:visible_custom_field_ids, extract_custom_field_ids(visible_custom_fields))
|
||||
|> assign(:selected_member_id, parse_highlight_param(params["highlight"]))
|
||||
|
||||
next_sig = build_signature(socket)
|
||||
|
||||
|
|
@ -798,6 +806,18 @@ defmodule MvWeb.MemberLive.Index do
|
|||
end
|
||||
end
|
||||
|
||||
# Parses optional "highlight" URL param (member id for selected row styling). Returns nil if missing or invalid.
|
||||
defp parse_highlight_param(nil), do: nil
|
||||
defp parse_highlight_param(""), do: nil
|
||||
|
||||
defp parse_highlight_param(id) when is_binary(id) do
|
||||
if String.length(id) <= @max_uuid_length and match?({:ok, _}, Ecto.UUID.cast(id)),
|
||||
do: id,
|
||||
else: nil
|
||||
end
|
||||
|
||||
defp parse_highlight_param(_), do: nil
|
||||
|
||||
defp merge_fields_param_from_uri(params, nil), do: params
|
||||
|
||||
defp merge_fields_param_from_uri(params, %URI{query: query}) when is_binary(query) do
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue