2
有子菜單的SiteMap定義的several解釋。但它們都依賴於一個菜單定義形式如下:具有Loc定義的Liftweb子菜單
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
成爲上面管理菜單的子菜單。這個定義甚至可能嗎?