feat: allows for navbar menu exclution with exclude list
This commit is contained in:
parent
cffb3cf384
commit
6ab7489f9b
|
|
@ -4,7 +4,8 @@
|
|||
(:use :cl)
|
||||
(:export :internal-disable-debugger)
|
||||
(:export :internal-quit
|
||||
:pht))
|
||||
:pht
|
||||
:member-string))
|
||||
|
||||
(in-package :asteroid.app-utils)
|
||||
|
||||
|
|
@ -19,6 +20,11 @@
|
|||
(internal-quit)))
|
||||
(setf *debugger-hook* #'internal-exit)))
|
||||
|
||||
(defun member-string (item seq)
|
||||
"Checkes if a string 'item' is a member of a list. Returns t or nil for the finding result."
|
||||
(when (member item seq :test #'string-equal)
|
||||
t))
|
||||
|
||||
(defun internal-quit (&optional code)
|
||||
"Taken from the cliki"
|
||||
;; This group from "clocc-port/ext.lisp"
|
||||
|
|
|
|||
|
|
@ -6,25 +6,33 @@
|
|||
framesetp='framesetp'>
|
||||
<!-- Navbar definition -->
|
||||
<nav class="nav">
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" home-href)) :target (when framesetp "_self"))'>
|
||||
Home
|
||||
</a>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" player-href)) :target (when framesetp "_self"))'>
|
||||
Player
|
||||
</a>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" about-href)) :target (when framesetp "_self"))'>
|
||||
About
|
||||
</a>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" status-href)) :target (when framesetp "_self"))'>
|
||||
Status
|
||||
</a>
|
||||
<c:when test="current-user">
|
||||
<c:unless test='(asteroid::member-string "home" (** :navbar-exclude))'>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" home-href)) :target (when framesetp "_self"))'>
|
||||
Home
|
||||
</a>
|
||||
</c:unless>
|
||||
<c:unless test='(asteroid::member-string "player" (** :navbar-exclude))'>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" player-href)) :target (when framesetp "_self"))'>
|
||||
Player
|
||||
</a>
|
||||
</c:unless>
|
||||
<c:unless test='(asteroid::member-string "about" (** :navbar-exclude))'>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" about-href)) :target (when framesetp "_self"))'>
|
||||
About
|
||||
</a>
|
||||
</c:unless>
|
||||
<c:unless test='(asteroid::member-string "status" (** :navbar-exclude))'>
|
||||
<a lquery='(attr :href (eval (format nil "/asteroid/~a" status-href)) :target (when framesetp "_self"))'>
|
||||
Status
|
||||
</a>
|
||||
</c:unless>
|
||||
<c:when test='(and current-user (not (asteroid::member-string "profile" (** :navbar-exclude))))'>
|
||||
<a href="/asteroid/profile"
|
||||
lquery='(attr :target (when framesetp "_self"))'>
|
||||
Profile
|
||||
</a>
|
||||
</c:when>
|
||||
<c:when test='(equal "admin" (clip current-user :role))'>
|
||||
<c:when test='(and (equal "admin" (clip current-user :role)) (not (asteroid::member-string "admin" (** :navbar-exclude))))'>
|
||||
<a href="/asteroid/admin"
|
||||
lquery='(attr :target (when framesetp "_self"))'>
|
||||
Admin
|
||||
|
|
|
|||
Loading…
Reference in New Issue