New Builder Panel Template

This commit is contained in:
David Botton 2022-08-16 23:00:40 -04:00
parent f1318dfdb1
commit 59401ad735
8 changed files with 100 additions and 0 deletions

View file

@ -0,0 +1,8 @@
# New CLOG Web project
### _Your Name <your.name@example.com>_
This is a project to do ... something.
## License
Specify license here

View file

@ -0,0 +1 @@
<data id="I3869693078" data-in-package="<%= (@ sys-name) %>" data-custom-slots="" data-clog-next-id="3" data-clog-title="main-panel"></data><div data-clog-type="w3-container" class="w3-container w3-card-2" data-clog-name="main-container" style="width: 300px; height: 150px; box-sizing: content-box; position: relative;">Hello World<button data-clog-type="button" data-clog-name="next-button" style="box-sizing: content-box; position: absolute; left: 110px; top: 90px;" data-on-click="(replace-element panel (create-next-panel panel))">Next Panel</button></div>

View file

@ -0,0 +1,24 @@
(in-package :<%= (@ sys-name) %>)
(defclass main-panel (clog:clog-panel)
((next-button :reader next-button)
(main-container :reader main-container)))
(defun create-main-panel
(clog-obj &key (hidden nil) (class nil) (html-id nil) (auto-place t))
(let ((panel
(change-class
(clog:create-div clog-obj :content
"<div class=\"w3-container w3-card-2\" style=\"width: 300px; height: 150px; box-sizing: content-box; position: relative;\" id=\"CLOGB3869692796\" data-clog-name=\"main-container\">Hello World<button style=\"box-sizing: content-box; position: absolute; left: 110px; top: 90px;\" id=\"CLOGB3869692797\" data-clog-name=\"next-button\">Next Panel</button></div>"
:hidden hidden :class class :html-id html-id
:auto-place auto-place)
'main-panel)))
(setf (slot-value panel 'next-button)
(attach-as-child clog-obj "CLOGB3869692797" :clog-type
'clog:clog-button :new-id t))
(setf (slot-value panel 'main-container)
(attach-as-child clog-obj "CLOGB3869692796" :clog-type
'clog:clog-div :new-id t))
(clog:set-on-click (next-button panel)
(lambda (target)
(declare (ignorable target))
(replace-element panel (create-next-panel panel))))
panel))

View file

@ -0,0 +1 @@
<data id="I3869693014" data-in-package="<%= (@ sys-name) %>" data-custom-slots="" data-clog-next-id="3" data-clog-title="next-panel"></data><div data-clog-type="w3-container" class="w3-container w3-card-2" data-clog-name="next-container" style="width: 300px; height: 150px; box-sizing: content-box; position: relative;">Next Panel<button data-clog-type="button" data-clog-name="next-button" style="box-sizing: content-box; position: absolute; left: 110px; top: 90px;" data-on-click="(replace-element panel (create-main-panel panel))">Go to Main</button></div>

View file

@ -0,0 +1,24 @@
(in-package :<%= (@ sys-name) %>)
(defclass next-panel (clog:clog-panel)
((next-button :reader next-button)
(next-container :reader next-container)))
(defun create-next-panel
(clog-obj &key (hidden nil) (class nil) (html-id nil) (auto-place t))
(let ((panel
(change-class
(clog:create-div clog-obj :content
"<div class=\"w3-container w3-card-2\" style=\"width: 300px; height: 150px; box-sizing: content-box; position: relative;\" id=\"CLOGB38696928071\" data-clog-name=\"next-container\">Next Panel<button style=\"box-sizing: content-box; position: absolute; left: 110px; top: 90px;\" id=\"CLOGB3869692808\" data-clog-name=\"next-button\">Go to Main</button></div>"
:hidden hidden :class class :html-id html-id
:auto-place auto-place)
'next-panel)))
(setf (slot-value panel 'next-button)
(attach-as-child clog-obj "CLOGB3869692808" :clog-type
'clog:clog-button :new-id t))
(setf (slot-value panel 'next-container)
(attach-as-child clog-obj "CLOGB38696928071" :clog-type
'clog:clog-div :new-id t))
(clog:set-on-click (next-button panel)
(lambda (target)
(declare (ignorable target))
(replace-element panel (create-main-panel panel))))
panel))

View file

@ -0,0 +1,17 @@
(asdf:defsystem #:<%= (@ sys-name) %>
:description "New CLOG System"
:author "some@one.com"
:license "BSD"
:version "0.0.0"
:serial t
:entry-point "<%= (@ sys-name) %>:start-app"
:depends-on (#:clog) ; add clog plugins here as #:plugin for run time
:components ((:file "<%= (@ sys-name) %>")
(:file "main")
(:file "next")))
(asdf:defsystem #:<%= (@ sys-name) %>/tools
:defsystem-depends-on (:clog)
:depends-on (#:<%= (@ sys-name) %> #:clog/tools) ; add clog plugins here as #:plugin/tools for design time
:components ((:clog-file "main")
(:clog-file "next")))

View file

@ -0,0 +1,20 @@
(defpackage #:<%= (@ sys-name) %>
(:use #:cl #:clog #:clog-web)
(:export start-app))
(in-package :<%= (@ sys-name) %>)
(defun on-new-window (body)
;; Add the clog-web look and feel
(clog-web-initialize body)
;; Use the panel-box-layout to center horizontally
;; and vertically our div on the screen.
(let* ((layout (create-panel-box-layout body)))
(center-children (center-panel layout))
(create-main-panel (center-panel layout))))
(defun start-app ()
(initialize 'on-new-window
:static-root (merge-pathnames "./www/"
(asdf:system-source-directory :<%= (@ sys-name) %>)))
(open-browser))

View file

@ -2268,6 +2268,11 @@
(defparameter *supported-templates*
(list
'(:name "New Builder Panel Project"
:code "nbp"
:type :system
:www "templates/www/"
:loc "templates/projects/clog-panel/")
'(:name "New CLOG Basic HTML Project"
:code "ncp"
:type :system