Merge branch 'main' into bug/289_rauthy_error_message
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
commit
ac13a39e7c
11 changed files with 165 additions and 198 deletions
|
|
@ -118,7 +118,7 @@ defmodule MvWeb.Layouts.Sidebar do
|
|||
/>
|
||||
<% end %>
|
||||
<%= if can_access_page?(@current_user, PagePaths.settings()) do %>
|
||||
<.menu_subitem href={~p"/admin/import-export"} label={gettext("Import/Export")} />
|
||||
<.menu_subitem href={~p"/admin/import"} label={gettext("Import")} />
|
||||
<.menu_subitem href={~p"/settings"} label={gettext("Settings")} />
|
||||
<% end %>
|
||||
</.menu_group>
|
||||
|
|
|
|||
|
|
@ -219,6 +219,9 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do
|
|||
send(self(), {:editing_section_changed, nil})
|
||||
end
|
||||
|
||||
# Get actor from assigns or fall back to socket assigns
|
||||
actor = Map.get(assigns, :actor, socket.assigns[:actor])
|
||||
|
||||
{:ok,
|
||||
socket
|
||||
|> assign(assigns)
|
||||
|
|
@ -228,7 +231,7 @@ defmodule MvWeb.CustomFieldLive.IndexComponent do
|
|||
|> assign_new(:show_delete_modal, fn -> false end)
|
||||
|> assign_new(:custom_field_to_delete, fn -> nil end)
|
||||
|> assign_new(:slug_confirmation, fn -> "" end)
|
||||
|> stream(:custom_fields, stream_custom_fields(assigns[:actor], self()), reset: true)}
|
||||
|> stream(:custom_fields, stream_custom_fields(actor, self()), reset: true)}
|
||||
end
|
||||
|
||||
@impl true
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
defmodule MvWeb.ImportExportLive do
|
||||
defmodule MvWeb.ImportLive do
|
||||
@moduledoc """
|
||||
LiveView for importing and exporting members via CSV.
|
||||
LiveView for importing members via CSV.
|
||||
|
||||
## Features
|
||||
- CSV member import (admin only)
|
||||
|
|
@ -38,7 +38,7 @@ defmodule MvWeb.ImportExportLive do
|
|||
alias Mv.Membership.Import.ImportRunner
|
||||
alias Mv.Membership.Import.MemberCSV
|
||||
alias MvWeb.Authorization
|
||||
alias MvWeb.ImportExportLive.Components
|
||||
alias MvWeb.ImportLive.Components
|
||||
|
||||
on_mount {MvWeb.LiveHelpers, :ensure_user_role_loaded}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ defmodule MvWeb.ImportExportLive do
|
|||
|
||||
socket =
|
||||
socket
|
||||
|> assign(:page_title, gettext("Import/Export"))
|
||||
|> assign(:page_title, gettext("Import"))
|
||||
|> assign(:club_name, club_name)
|
||||
|> assign(:import_state, nil)
|
||||
|> assign(:import_progress, nil)
|
||||
|
|
@ -90,13 +90,6 @@ defmodule MvWeb.ImportExportLive do
|
|||
def render(assigns) do
|
||||
~H"""
|
||||
<Layouts.app flash={@flash} current_user={@current_user} club_name={@club_name}>
|
||||
<.header>
|
||||
{gettext("Import/Export")}
|
||||
<:subtitle>
|
||||
{gettext("Import members from CSV files or export member data.")}
|
||||
</:subtitle>
|
||||
</.header>
|
||||
|
||||
<%= if Authorization.can?(@current_user, :create, Mv.Membership.Member) do %>
|
||||
<%!-- CSV Import Section --%>
|
||||
<.form_section title={gettext("Import Members (CSV)")}>
|
||||
|
|
@ -107,18 +100,6 @@ defmodule MvWeb.ImportExportLive do
|
|||
<Components.import_progress {assigns} />
|
||||
<% end %>
|
||||
</.form_section>
|
||||
|
||||
<%!-- Export Section (Placeholder) --%>
|
||||
<.form_section title={gettext("Export Members (CSV)")}>
|
||||
<div role="note" class="alert alert-info">
|
||||
<.icon name="hero-information-circle" class="size-5" aria-hidden="true" />
|
||||
<div>
|
||||
<p class="text-sm">
|
||||
{gettext("Export functionality will be available in a future release.")}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</.form_section>
|
||||
<% else %>
|
||||
<div role="alert" class="alert alert-error">
|
||||
<.icon name="hero-exclamation-circle" class="size-5" aria-hidden="true" />
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
defmodule MvWeb.ImportExportLive.Components do
|
||||
defmodule MvWeb.ImportLive.Components do
|
||||
@moduledoc """
|
||||
Function components for the Import/Export LiveView: import form, progress, results,
|
||||
Function components for the Import LiveView: import form, progress, results,
|
||||
custom fields notice, and template links. Keeps the main LiveView focused on
|
||||
mount/handle_event/handle_info and glue code.
|
||||
"""
|
||||
|
|
@ -91,8 +91,8 @@ defmodule MvWeb.Router do
|
|||
live "/admin/roles/:id", RoleLive.Show, :show
|
||||
live "/admin/roles/:id/edit", RoleLive.Form, :edit
|
||||
|
||||
# Import/Export (Admin only)
|
||||
live "/admin/import-export", ImportExportLive
|
||||
# Import (Admin only)
|
||||
live "/admin/import", ImportLive
|
||||
|
||||
post "/members/export.csv", MemberExportController, :export
|
||||
post "/members/export.pdf", MemberPdfExportController, :export
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue