mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-09 20:30:26 -08:00
move themes to another file
This commit is contained in:
parent
421ee95bf1
commit
f776df4862
4 changed files with 86 additions and 52 deletions
1
clog.asd
1
clog.asd
|
|
@ -38,6 +38,7 @@
|
||||||
(:file "clog-auth")
|
(:file "clog-auth")
|
||||||
(:file "clog-gui")
|
(:file "clog-gui")
|
||||||
(:file "clog-web")
|
(:file "clog-web")
|
||||||
|
(:file "clog-web-themes")
|
||||||
(:file "clog-helpers")))
|
(:file "clog-helpers")))
|
||||||
|
|
||||||
(asdf:defsystem #:clog/docs
|
(asdf:defsystem #:clog/docs
|
||||||
|
|
|
||||||
84
source/clog-web-themes.lisp
Normal file
84
source/clog-web-themes.lisp
Normal file
|
|
@ -0,0 +1,84 @@
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
;;;; CLOG - The Common Lisp Omnificent GUI ;;;;
|
||||||
|
;;;; (c) 2020-2022 David Botton ;;;;
|
||||||
|
;;;; License BSD 3 Clause ;;;;
|
||||||
|
;;;; ;;;;
|
||||||
|
;;;; clog-web-themes.lisp ;;;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
;; Built in clog-web-site themese
|
||||||
|
|
||||||
|
(cl:in-package :clog-web)
|
||||||
|
|
||||||
|
(defsection @clog-web-themes (:title "CLOG Web Site Themes")
|
||||||
|
"Built in themes"
|
||||||
|
(default-theme function))
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
;; default-theme ;;
|
||||||
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(defun default-theme (body website page properties)
|
||||||
|
"The default theme for clog-web-site.
|
||||||
|
Settings available:
|
||||||
|
:menu-class - w3 color class for menu bar
|
||||||
|
Page properties:
|
||||||
|
:menu - ((\"Menu Name\" ((\"Menu Item\" \"link\"))))
|
||||||
|
:content"
|
||||||
|
(let ((sb (create-style-block body)))
|
||||||
|
(add-style sb :element "a" '(("text-decoration" :none))))
|
||||||
|
(let* ((row (create-web-auto-row body))
|
||||||
|
(left (create-web-auto-column row))
|
||||||
|
(right (create-web-auto-column row :vertical-align :middle)))
|
||||||
|
(when (logo website)
|
||||||
|
(set-geometry (create-img (create-a left
|
||||||
|
:link (url website))
|
||||||
|
:url-src (logo website))
|
||||||
|
:height 75))
|
||||||
|
(create-span (create-a right
|
||||||
|
:link (url website))
|
||||||
|
:content (title website)
|
||||||
|
:class "w3-xlarge w3-sans-serif"))
|
||||||
|
(let ((menu (create-web-menu-bar body :class "w3-card-4")))
|
||||||
|
(when (getf (settings website) :menu-class)
|
||||||
|
(add-class menu (getf (settings website) :menu-class)))
|
||||||
|
(dolist (drop-down (getf properties :menu))
|
||||||
|
(let ((drop (create-web-menu-drop-down menu
|
||||||
|
:content (first drop-down)
|
||||||
|
:class "w3-border")))
|
||||||
|
(dolist (item (second drop-down))
|
||||||
|
(create-web-menu-item drop
|
||||||
|
:content (first item)
|
||||||
|
:link (second item))))))
|
||||||
|
(create-br body)
|
||||||
|
(let ((c (getf properties :content)))
|
||||||
|
(when c
|
||||||
|
(typecase c
|
||||||
|
(string
|
||||||
|
(create-div body :content c))
|
||||||
|
(function
|
||||||
|
(funcall c body))
|
||||||
|
(t
|
||||||
|
(create-div body :content (format nil "~A" c))))))
|
||||||
|
(when (eq page :login)
|
||||||
|
(let* ((outter (create-web-container body))
|
||||||
|
(form (create-form outter))
|
||||||
|
(p1 (create-p form))
|
||||||
|
(l1 (create-label p1 :content "User Name"))
|
||||||
|
(user (create-form-element p1 :text :name "username" :class "w3-input"))
|
||||||
|
(p2 (create-p form))
|
||||||
|
(l2 (create-label p2 :content "Password"))
|
||||||
|
(pass (create-form-element p2 :password :name "password" :class "w3-input"))
|
||||||
|
(p3 (create-p form)))
|
||||||
|
(declare (ignore l1 l2))
|
||||||
|
(setf (maximum-width outter) (unit :px 500))
|
||||||
|
(setf (requiredp user) t)
|
||||||
|
(setf (requiredp pass) t)
|
||||||
|
(create-form-element form :submit :value "Submit"
|
||||||
|
:class (format nil "~A ~A" "w3-button"
|
||||||
|
(getf (settings website)
|
||||||
|
:menu-class)))
|
||||||
|
(set-on-submit form (getf properties :on-submit))))
|
||||||
|
(create-br body)
|
||||||
|
(create-br body)
|
||||||
|
(create-div body :content (format nil "~A" (footer website))))
|
||||||
|
|
@ -98,7 +98,6 @@
|
||||||
(clog-web-site class)
|
(clog-web-site class)
|
||||||
(clog-web-routes-from-menu function)
|
(clog-web-routes-from-menu function)
|
||||||
(clog-web-meta function)
|
(clog-web-meta function)
|
||||||
(default-theme function)
|
|
||||||
(theme generic-function)
|
(theme generic-function)
|
||||||
(settings generic-function)
|
(settings generic-function)
|
||||||
(url generic-function)
|
(url generic-function)
|
||||||
|
|
@ -1028,57 +1027,6 @@ if confirmed or nil if canceled. CANCEL-TEXT is only displayed if modal is t"
|
||||||
:reader logo))
|
:reader logo))
|
||||||
(:documentation "Website information"))
|
(:documentation "Website information"))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
|
||||||
;; default-theme ;;
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
|
||||||
|
|
||||||
(defun default-theme (body website page properties)
|
|
||||||
"The default theme for clog-web-site.
|
|
||||||
Settings available:
|
|
||||||
:menu-class - w3 color class for menu bar
|
|
||||||
Page properties:
|
|
||||||
:menu - ((\"Menu Name\" ((\"Menu Item\" \"link\"))))
|
|
||||||
:content"
|
|
||||||
(declare (ignore page))
|
|
||||||
(let ((sb (create-style-block body)))
|
|
||||||
(add-style sb :element "a" '(("text-decoration" :none))))
|
|
||||||
(let* ((row (create-web-auto-row body))
|
|
||||||
(left (create-web-auto-column row))
|
|
||||||
(right (create-web-auto-column row :vertical-align :middle)))
|
|
||||||
(when (logo website)
|
|
||||||
(set-geometry (create-img (create-a left
|
|
||||||
:link (url website))
|
|
||||||
:url-src (logo website))
|
|
||||||
:height 75))
|
|
||||||
(create-span (create-a right
|
|
||||||
:link (url website))
|
|
||||||
:content (title website)
|
|
||||||
:class "w3-xlarge w3-sans-serif"))
|
|
||||||
(let ((menu (create-web-menu-bar body :class "w3-card-4")))
|
|
||||||
(when (getf (settings website) :menu-class)
|
|
||||||
(add-class menu (getf (settings website) :menu-class)))
|
|
||||||
(dolist (drop-down (getf properties :menu))
|
|
||||||
(let ((drop (create-web-menu-drop-down menu
|
|
||||||
:content (first drop-down)
|
|
||||||
:class "w3-border")))
|
|
||||||
(dolist (item (second drop-down))
|
|
||||||
(create-web-menu-item drop
|
|
||||||
:content (first item)
|
|
||||||
:link (second item))))))
|
|
||||||
(create-br body)
|
|
||||||
(let ((c (getf properties :content)))
|
|
||||||
(when c
|
|
||||||
(typecase c
|
|
||||||
(string
|
|
||||||
(create-div body :content c))
|
|
||||||
(function
|
|
||||||
(funcall c body))
|
|
||||||
(t
|
|
||||||
(create-div body :content (format nil "~A" c))))))
|
|
||||||
(create-br body)
|
|
||||||
(create-br body)
|
|
||||||
(create-div body :content (format nil "~A" (footer website))))
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
;; clog-web-meta ;;
|
;; clog-web-meta ;;
|
||||||
;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,7 @@ embedded in a native template application.)"
|
||||||
(@clog-auth section)
|
(@clog-auth section)
|
||||||
(@clog-gui section)
|
(@clog-gui section)
|
||||||
(@clog-web section)
|
(@clog-web section)
|
||||||
|
(@clog-web-themes section)
|
||||||
(@clog-body section)
|
(@clog-body section)
|
||||||
(@clog-window section)
|
(@clog-window section)
|
||||||
(@clog-document section)
|
(@clog-document section)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue