Add statistics route, permissions, and sidebar entry
- /statistics route and PagePaths.statistics - Permission sets: viewer and admin can access /statistics - Sidebar link with can_access_page check - Plug and sidebar tests updated
This commit is contained in:
parent
fd10fe5cf6
commit
919a8e4ebd
7 changed files with 61 additions and 6 deletions
|
|
@ -178,7 +178,9 @@ defmodule Mv.Authorization.PermissionSets do
|
|||
# Groups overview
|
||||
"/groups",
|
||||
# Group detail
|
||||
"/groups/:slug"
|
||||
"/groups/:slug",
|
||||
# Statistics
|
||||
"/statistics"
|
||||
]
|
||||
}
|
||||
end
|
||||
|
|
@ -243,7 +245,9 @@ defmodule Mv.Authorization.PermissionSets do
|
|||
# Group detail
|
||||
"/groups/:slug",
|
||||
# Edit group
|
||||
"/groups/:slug/edit"
|
||||
"/groups/:slug/edit",
|
||||
# Statistics
|
||||
"/statistics"
|
||||
]
|
||||
}
|
||||
end
|
||||
|
|
|
|||
|
|
@ -88,6 +88,14 @@ defmodule MvWeb.Layouts.Sidebar do
|
|||
/>
|
||||
<% end %>
|
||||
|
||||
<%= if can_access_page?(@current_user, PagePaths.statistics()) do %>
|
||||
<.menu_item
|
||||
href={~p"/statistics"}
|
||||
icon="hero-chart-bar"
|
||||
label={gettext("Statistics")}
|
||||
/>
|
||||
<% end %>
|
||||
|
||||
<%= if admin_menu_visible?(@current_user) do %>
|
||||
<.menu_group
|
||||
icon="hero-cog-6-tooth"
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ defmodule MvWeb.PagePaths do
|
|||
# Sidebar top-level menu paths
|
||||
@members "/members"
|
||||
@membership_fee_types "/membership_fee_types"
|
||||
@statistics "/statistics"
|
||||
|
||||
# Administration submenu paths (all must match router)
|
||||
@users "/users"
|
||||
|
|
@ -31,6 +32,9 @@ defmodule MvWeb.PagePaths do
|
|||
@doc "Path for Membership Fee Types index (sidebar and page permission check)."
|
||||
def membership_fee_types, do: @membership_fee_types
|
||||
|
||||
@doc "Path for Statistics page (sidebar and page permission check)."
|
||||
def statistics, do: @statistics
|
||||
|
||||
@doc "Paths for Administration menu; show group if user can access any of these."
|
||||
def admin_menu_paths, do: @admin_page_paths
|
||||
|
||||
|
|
|
|||
|
|
@ -73,6 +73,9 @@ defmodule MvWeb.Router do
|
|||
|
||||
# Membership Fee Types Management
|
||||
live "/membership_fee_types", MembershipFeeTypeLive.Index, :index
|
||||
|
||||
# Statistics
|
||||
live "/statistics", StatisticsLive, :index
|
||||
live "/membership_fee_types/new", MembershipFeeTypeLive.Form, :new
|
||||
live "/membership_fee_types/:id/edit", MembershipFeeTypeLive.Form, :edit
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue