-
Notifications
You must be signed in to change notification settings - Fork 3
/
bootstrap-navbar-navigation.lisp
36 lines (30 loc) · 1.48 KB
/
bootstrap-navbar-navigation.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
(in-package :weblocks-twitter-bootstrap-application)
(defwidget bootstrap-navbar-navigation (navigation)
())
(defun bootstrap-navbar-menu-wt (&rest args &key menu-id menu-header menu-content menu-empty-p menu-empty-message menu-ordered-list-p)
(with-html-to-string
(:div :class "navbar"
:id menu-id
(:div :class "navbar-inner"
(when menu-header
(htm (:h1 (str menu-header))))
(:ul :class "nav" (str menu-content))))))
(deftemplate :bootstrap-navbar-menu-wt 'bootstrap-navbar-menu-wt)
(defun bootstrap-navbar-menu-item-wt (&rest args &key item-id pane-class span-class content target-is-function pane-selected-or-disabled item-href)
(with-html-to-string
(:li :id item-id :class (if pane-selected-or-disabled "active")
(if target-is-function
(cl-who:htm (str content))
(cl-who:htm (:a :href item-href (str content)))))))
(deftemplate :bootstrap-navbar-menu-item-wt 'bootstrap-navbar-menu-item-wt)
(defmethod render-navigation-menu :around ((obj bootstrap-navbar-navigation) &rest args &key menu-args &allow-other-keys)
(declare (ignore args))
(apply #'render-menu (navigation-menu-items obj)
:base (selector-base-uri obj)
:selected-pane (static-selector-current-pane obj)
:header (navigation-header obj)
:container-id (dom-id obj)
:empty-message "No navigation entries"
:menu-template #'bootstrap-navbar-menu-wt
:item-template #'bootstrap-navbar-menu-item-wt
menu-args))