mirror of
https://github.com/rabbibotton/clog.git
synced 2026-01-06 01:02:14 -08:00
handle menus that end up with zero items
This commit is contained in:
parent
ecc1143be5
commit
25d501fa27
2 changed files with 21 additions and 9 deletions
|
|
@ -45,17 +45,21 @@ Page properties:
|
|||
(when (getf (settings website) :color-class)
|
||||
(add-class menu (getf (settings website) :color-class)))
|
||||
(dolist (drop-down (getf properties :menu))
|
||||
(let ((drop (create-web-menu-drop-down menu
|
||||
:content (first drop-down)
|
||||
:class "w3-border")))
|
||||
(let ((drop (create-web-menu-drop-down menu
|
||||
:content (first drop-down)
|
||||
:class "w3-border"))
|
||||
(count 0))
|
||||
(dolist (item (second drop-down))
|
||||
(when (or (and (fourth item)
|
||||
(clog-auth:is-authorized-p (roles website)
|
||||
(fourth item)))
|
||||
(eq (fourth item) nil))
|
||||
(incf count)
|
||||
(create-web-menu-item drop
|
||||
:content (first item)
|
||||
:link (second item)))))))
|
||||
:link (second item))))
|
||||
(when (eql count 0)
|
||||
(destroy (parent-element drop))))))
|
||||
(create-br body)
|
||||
(let ((c (getf properties :content)))
|
||||
(when c
|
||||
|
|
|
|||
|
|
@ -1110,13 +1110,21 @@ connection"))
|
|||
;; create-web-page ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(defgeneric create-web-page (clog-obj page properties)
|
||||
(defgeneric create-web-page (clog-obj page properties &key authorize)
|
||||
(:documentation "Use the clog-web-site THEME to create PAGE with
|
||||
CLOG-OBJ as parent"))
|
||||
CLOG-OBJ as parent. PAGE is a symbol to identify the pages purpose to
|
||||
the website theme. Themes are required to provide certain default
|
||||
pages see clog-web-themes file. If AUTHORIZE then PAGE is used also as
|
||||
a CLOG-Auth action to be checked if the current users roles have
|
||||
permission to PAGE"))
|
||||
|
||||
(defmethod create-web-page ((obj clog-obj) page properties)
|
||||
(funcall (theme (get-web-site obj))
|
||||
obj (get-web-site obj) page properties))
|
||||
(defmethod create-web-page ((obj clog-obj) page properties &key authorize)
|
||||
(if (or (and authorize
|
||||
(clog-auth:is-authorized-p (roles (get-web-site obj)) page))
|
||||
(not authorize))
|
||||
(funcall (theme (get-web-site obj))
|
||||
obj (get-web-site obj) page properties)
|
||||
(create-div obj :content "Authorization failure")))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Utilities
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue