Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
gendl
tutorials
Commits
d314e4d5
Commit
d314e4d5
authored
Jan 28, 2021
by
Dave Cooper
Browse files
allow to filter which menus are included
parent
50b38629
Changes
3
Hide whitespace changes
Inline
Side-by-side
geysr/source/assembly.gdl
View file @
d314e4d5
...
...
@@ -73,7 +73,7 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
(
menu
-
div
-
class
nil
)
(
menu
-
div
-
style
nil
)
)
(
menu
-
included
-
children
:
all
)
)
:
computed
-
slots
...
...
@@ -205,7 +205,8 @@ x 1. Update welcome message to reflect empty object and refer to File->New.
(the inspector main-div)))))
(menu :type '
menu
:
div
-
class
(
the
menu
-
div
-
class
)
:
div
-
style
(
the
div
-
style
)
:
div
-
style
(
the
menu
-
div
-
style
)
:
included
-
children
(
the
menu
-
included
-
children
)
:
pass
-
down
(
design
-
mode
?
local
-
assets
?
click
-
mode
expand
-
mode
)
:
user
-
mode
?
(
the
user
-
mode
?-
default
)
:
set
-
click
-
mode
-
func
#
'(lambda(mode) (the (set-slot! :click-mode mode)))
...
...
geysr/source/menu-node.gdl
View file @
d314e4d5
...
...
@@ -34,69 +34,66 @@
(onfocus nil)
(depth (if (or (not (the parent)) (not (typep (the parent) 'menu-node)))
0
(1+ (the parent depth)))))
(1+ (the parent depth))))
(included-children :all))
:computed-slots ((%child-nodes
(remove-if-not
#'(lambda(child)
(typep child 'menu-node)) (the children)))
)
(and
(typep child 'menu-node)
(or (eql (the included-children) :all)
(member (first (theo child root-path))
(the included-children)))))
(the children)))
:functions
((html
(&optional menu-name)
(with-cl-who-string (:indent t)
(let* ((key (make-keyword menu-name))
(child-nodes (if menu-name
(remove-if-not #'(lambda(child)
(eql (first (the-object child root-path)) key))
(the %child-nodes))
(the %child-nodes))))
(cond ((and child-nodes (zerop (the depth)))
(htm ((:nav :id (the id))
(str (the (ul child-nodes))))))
(html
(with-cl-who-string (:indent t)
(let* ((child-nodes (the %child-nodes)))
(cond ((and child-nodes (zerop (the depth)))
(htm ((:nav :id (the id))
(str (the (ul child-nodes))))))
(child-nodes
(htm (str (the (ul child-nodes)))))
(child-nodes
(htm (str (the (ul child-nodes)))))
(t (htm ((:li :onmouseover "hideMenus(event);")
((:a :href "#"
:class "inactive"
:title (the title)) (str (the label))))))))))
(t (htm ((:li :onmouseover "hideMenus(event);")
((:a :href "#"
:class "inactive"
:title (the title)) (str (the label))))))))))
(ul (child-nodes)
(with-cl-who-string (:indent t)
((:ul
:id (the id)
:onmouseover
(unless (zerop (the depth))
(format nil "addVisible(event, ~a);" (the depth))))
(ul (with-cl-who-string (:indent t)
((:ul
:id (the id)
:onmouseover
(unless (zerop (the depth))
(format nil "addVisible(event, ~a);" (the depth))))
(dolist (child child-nodes)
(if (the-object child %child-nodes)
(htm ((:li :id (the-object child id)
:tabindex "0"
:onmouseover "hideMenus(event);"
:onclick (when (zerop (the depth))
"makeMenuBarHoverable(event);"))
(dolist (child
(the %
child-nodes)
)
(if (the-object child %child-nodes)
(htm ((:li :id (the-object child id)
:tabindex "0"
:onmouseover "hideMenus(event);"
:onclick (when (zerop (the depth))
"makeMenuBarHoverable(event);"))
((:a :href "#" :id (format nil "a ~a" (the-object child id))
:title (the-object child title))
((:a :href "#" :id (format nil "a ~a" (the-object child id))
:title (the-object child title))
(str (the-object child label))
(str (the-object child label))
(when (>= (the-object child depth) 2)
(htm ((:span :class "menu-right-icon")
((:i :class "fas fa-caret-right"))))))
(str (the-object child html))))
(str (the-object child html)))))))
(when (>= (the-object child depth) 2)
(htm ((:span :class "menu-right-icon")
((:i :class "fas fa-caret-right"))))))
(str (the-object child html))))
(str (the-object child html))))))))
(set-new-geysr-object!
:functions
((set-new-geysr-object!
(object-type)
(the menu-object geysr (set-new-geysr-object! object-type)))))
...
...
geysr/source/menu.gdl
View file @
d314e4d5
...
...
@@ -37,7 +37,12 @@
(development-mode? nil :settable)
(user-mode? nil :settable)
(design-mode? nil)
(local-assets? t))
(local-assets? t)
("Keyword `:all` or list of keyword symbols.
These dropdown menus will be included in the rendering, or `:all` to include all defined ones."
included-children :all)
)
:computed-slots
...
...
@@ -111,15 +116,16 @@ function addVisible(event, level)
(inner-html (with-cl-who-string ()
(the force-refresh)
(str (the nav-html)))))
(str (the nav-html))))
(nav-html (the nav html)))
:objects ((nav :type 'geysr-nav :pass-down (menu-object design-mode? local-assets?)))
:objects ((nav :type 'geysr-nav :pass-down (menu-object design-mode? local-assets? included-children)))
:functions
((nav-html
(&optional menu-name)
(the nav (html menu-name)))
(
(toggle-force-refresh! () (the (set-slot! :force-refresh (not (the force-refresh)))))
(set-click-mode! (mode) (funcall (the set-click-mode-func) mode))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment