Add clog-new-app tool

This commit is contained in:
David Botton 2022-06-07 18:39:42 -04:00
parent 3004dfc5d3
commit c0c4a5f3a4
4 changed files with 46 additions and 2 deletions

View file

@ -104,6 +104,13 @@ CL-USER> (ql:quickload :clog)
CL-USER> (clog:run-demo 1)
```
The clog-new-app tool can be run with:
```
CL-USER> (ql:quickload :clog/tools)
CL-USER> (clog-tools:clog-new-app)
```
The clog-db-admin tool can be run with:
```
@ -260,8 +267,9 @@ CLOG Demos
Tool Summary
- clog-db-admin - SQLite3 admin tool
- clog-builder - Rapid visual interactive development for Web and GUIs
- clog-db-admin - SQLite3 admin tool
- clog-new-app - New application template tool
High Order Extensions to CLOG

View file

@ -53,4 +53,5 @@
:components ((:file "clog-db-admin")
(:file "clog-builder-settings")
(:file "clog-templates")
(:file "clog-new-app")
(:file "clog-builder")))

View file

@ -15,7 +15,7 @@
(defpackage #:clog-tools
(:use #:cl #:clog #:clog-gui #:clog-web)
(:export :clog-builder :clog-db-admin))
(:export :clog-builder :clog-db-admin :clog-new-app))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Implementation - CLOG Utilities

35
tools/clog-new-app.lisp Normal file
View file

@ -0,0 +1,35 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;; CLOG New App - New CLOG App Templates ;;;;
;;;; (c) 2020-2022 David Botton ;;;;
;;;; License BSD 3 Clause ;;;;
;;;; ;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(in-package :clog-tools)
(defun on-new-app (body)
"Launch instance of CLOG New Appp"
(set-html-on-close body "Connection Lost")
(let ((app (make-instance 'builder-app-data)))
(setf (connection-data-item body "builder-app-data") app)
(setf (title (html-document body)) "CLOG New App")
(clog-gui-initialize body)
(add-class body "w3-blue-grey")
(let* ((menu (create-gui-menu-bar body))
(icon (create-gui-menu-icon menu :on-click #'on-help-about-builder))
(file (create-gui-menu-drop-down menu :content "New App")))
(declare (ignore icon))
(create-gui-menu-item file :content "New Application Template" :on-click 'on-new-app-template)
(create-gui-menu-full-screen menu))
(set-on-before-unload (window body) (lambda(obj)
(declare (ignore obj))
;; return empty string to prevent nav off page
""))))
(defun clog-new-app (&key (port 8080) static-root)
"Start clog-new-app."
(if static-root
(initialize nil :port port :static-root static-root)
(initialize nil :port port))
(set-on-new-window 'on-new-app :path "/new")
(open-browser :url (format nil "http://127.0.0.1:~A/new" port)))