mirror of
https://github.com/rabbibotton/clog.git
synced 2025-12-05 18:20:36 -08:00
Clarify the concept of what a default route to on-new-window handler is
This commit is contained in:
parent
bde06426a0
commit
90595e50aa
3 changed files with 20 additions and 8 deletions
|
|
@ -94,11 +94,11 @@ example."
|
||||||
|
|
||||||
(defun set-on-new-window (on-new-window-handler
|
(defun set-on-new-window (on-new-window-handler
|
||||||
&key (path "/") (boot-file "/boot.html"))
|
&key (path "/") (boot-file "/boot.html"))
|
||||||
"Set or change the on-new-window handler or set a new one for PATH
|
"Set or change the ON-NEW-WINDOW-HANDLER for PATH using
|
||||||
using BOOT_FILE. Paths should always begin with a '/'. If PATH is set to
|
BOOT_FILE. Paths should always begin with a forward slash '/'. If PATH
|
||||||
\"default\" will use boot-file when the route can not be determined, ie
|
is set to \"default\" any path without another route and there is no
|
||||||
a static html file including boot.js that has not been added with this
|
static file matching the requested path ON-NEW-WINDOW-HANDLER and
|
||||||
function. If BOOT-FILE is nil path is removed."
|
BOOT-FILE will be used. If BOOT-FILE is nil path is removed."
|
||||||
(clog-connection:set-clog-path path boot-file)
|
(clog-connection:set-clog-path path boot-file)
|
||||||
(if boot-file
|
(if boot-file
|
||||||
(setf (gethash path *url-to-on-new-window*) on-new-window-handler)
|
(setf (gethash path *url-to-on-new-window*) on-new-window-handler)
|
||||||
|
|
|
||||||
10
static-files/tutorial/some-file.html
Normal file
10
static-files/tutorial/some-file.html
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script src="/js/jquery.min.js" type="text/javascript"></script>
|
||||||
|
<script src="/js/boot.js" type="text/javascript"></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p>I am just a regular file but I include boot.js. I am in the static-root
|
||||||
|
of the tutorial and demo apps.</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
|
@ -38,6 +38,7 @@
|
||||||
<li><a href='/page2'>/page2</a> - a CLOG app using an alternative boot file
|
<li><a href='/page2'>/page2</a> - a CLOG app using an alternative boot file
|
||||||
<li><a href='/page3'>/page3</a> - tutorial 11 as part of this tutorial
|
<li><a href='/page3'>/page3</a> - tutorial 11 as part of this tutorial
|
||||||
<li><a href='/tutorial/tut-11.html'>/tutorial/tut-11.html</a> - an html file using boot.js
|
<li><a href='/tutorial/tut-11.html'>/tutorial/tut-11.html</a> - an html file using boot.js
|
||||||
|
<li><a href='/tutorial/some-file.html'>/tutorial/some-file.html</a> - an html file using boot.js
|
||||||
<li><a href='/tutorial/regular-file.html'>'/tutorial/regular-file.html</a> - a regular html file
|
<li><a href='/tutorial/regular-file.html'>'/tutorial/regular-file.html</a> - a regular html file
|
||||||
</ul>"))
|
</ul>"))
|
||||||
|
|
||||||
|
|
@ -78,7 +79,7 @@
|
||||||
"/tutorial/tut-11.html")
|
"/tutorial/tut-11.html")
|
||||||
(on-tutorial11 body))
|
(on-tutorial11 body))
|
||||||
(t
|
(t
|
||||||
(create-div body :content "No dice!"))))
|
(create-div body :content "No dice! What do I do with you?"))))
|
||||||
|
|
||||||
(defun add-search-optimizations (path content)
|
(defun add-search-optimizations (path content)
|
||||||
;; The default boot.html that comes with CLOG has template
|
;; The default boot.html that comes with CLOG has template
|
||||||
|
|
@ -117,9 +118,10 @@
|
||||||
(set-on-new-window 'on-tutorial11 :path "/page3"
|
(set-on-new-window 'on-tutorial11 :path "/page3"
|
||||||
:boot-file "/tutorial/tut-11.html")
|
:boot-file "/tutorial/tut-11.html")
|
||||||
;; Setting a "default" path says that any use of an included boot.js
|
;; Setting a "default" path says that any use of an included boot.js
|
||||||
;; file will route to this function, in this case #'on-default
|
;; file by static html file will route to this function, in this case on-default
|
||||||
;; which will determine if this is coming from the path used in tutorial
|
;; which will determine if this is coming from the path used in tutorial
|
||||||
;; 11 - "http://127.0.0.1:8080/tutorial/tut-11.html" and if it does
|
;; 11 - "http://127.0.0.1:8080/tutorial/tut-11.html" and if it does
|
||||||
;; use on-tutorial11, and if not say "No Dice!"
|
;; use on-tutorial11, and if not say "No Dice!" such as when one pics
|
||||||
|
;; some-file.html which also loads boot.js
|
||||||
(set-on-new-window 'on-default :path "default")
|
(set-on-new-window 'on-default :path "default")
|
||||||
(open-browser))
|
(open-browser))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue