带有子菜单的 SiteMap 定义有多种解释。但它们都依赖于这种形式的菜单定义:
Menu.i("Info") / "info" submenus(
Menu.i("About") / "about" >> Hidden >> LocGroup("bottom"),
Menu.i("Contact") / "contact",
Menu.i("Feedback") / "feedback" >> LocGroup("bottom"))
但是,我的菜单定义如下所示:
val AdminLoginRequired = User.loginFirst
val sitemap = List(
Menu(Loc("Home", "index" :: Nil, "Home")),
Menu(Loc("Admin", "admin" :: Nil, "Admin", AdminLoginRequired, LocGroup("admin")))
) ::: Customer.menus ::: User.menus ::: Product.menus
我现在有Product.admin_menus
:
def viewProductMenuLoc = Full(Menu(Loc("ViewProduct" + menuNameSuffix, viewPath, S.?("view.product"))))
def editProductMenuLoc = Full(Menu(Loc("EditProduct" + menuNameSuffix, editPath, S.?("edit.product"))))
def listProductsMenuLoc = Full(Menu(Loc("ListProducts" + menuNameSuffix, listPath, S.?("list.products"))))
def indexProductsMenuLoc = Full(Menu(Loc("IndexProducts" + menuNameSuffix, indexPath, S.?("index.products"))))
def createProductMenuLoc = Full(Menu(Loc("CreateProduct" + menuNameSuffix, createPath, S.?("create.product"))))
lazy val admin_sitemap: List[Menu] = List(editProductMenuLoc, createProductMenuLoc, indexProductsMenuLoc).flatten(a => a)
我想为admin_sitemap
上面的管理菜单创建一个子菜单。这个定义甚至可能吗?