Restructures project with feature-based organization
Refactors project structure to support modular, feature-driven development Introduces comprehensive language localization support Adds menu management with role-based access control Implements dynamic sidebar and theme switching capabilities Enhances project scalability and maintainability
This commit is contained in:
parent
fac7754d7a
commit
d7f3c55a2a
60 changed files with 3214 additions and 20 deletions
35
app/Features/Menu/SideMenuViewComponent.cs
Normal file
35
app/Features/Menu/SideMenuViewComponent.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using Microsoft.AspNetCore.Mvc;
|
||||
using CalendarServer.Features.Menu.Models;
|
||||
using CalendarServer.Features.Menu.Services;
|
||||
|
||||
namespace CalendarServer.Features.Menu;
|
||||
|
||||
/// <summary>
|
||||
/// ViewComponent for rendering the side menu based on user role.
|
||||
/// </summary>
|
||||
public class SideMenuViewComponent : ViewComponent
|
||||
{
|
||||
private readonly IMenuService _menuService;
|
||||
|
||||
public SideMenuViewComponent(IMenuService menuService)
|
||||
{
|
||||
_menuService = menuService;
|
||||
}
|
||||
|
||||
public IViewComponentResult Invoke(UserRole? role = null)
|
||||
{
|
||||
// Default to Admin for demo (in real app, get from auth)
|
||||
var userRole = role ?? UserRole.Admin;
|
||||
|
||||
var currentUrl = HttpContext.Request.Path.Value;
|
||||
var groups = _menuService.GetMenuForRole(userRole, currentUrl);
|
||||
|
||||
var viewModel = new SideMenuViewModel
|
||||
{
|
||||
Groups = groups,
|
||||
CurrentUserRole = userRole
|
||||
};
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue