Commits

Greg Slepak committed 7b7c133

convert ajax demo and link_to to use web-root

  • Participants
  • Parent commits b08447d

Comments (0)

Files changed (3)

File example-site/dragonfly-framework/config.lsp

 ; do not modify the line below
 (dolist (pair (env)) (constant (global (sym (first pair))) (last pair)))
 
+; NOTE: the paths, including folders, shouldn't have slashes on the ends!
+
 ;===============================================================================
 ; Global Constants
 ;===============================================================================

File example-site/dragonfly-framework/dragonfly.lsp

 
 (define (web-root path)
 	; WEB_ROOT should have a "/" on the end
+	(if (starts-with path "/") (pop path))
 	(string WEB_ROOT path)
 )
 

File example-site/dragonfly-framework/plugins-active/dragonfly_basic.lsp

 		(set 'link-url (string "/" view "/" action))
 	)
 	
-  	(print "<a href='"link-url"'>"link-name"</a>")
+  	(print "<a href='"(web-root link-url)"'>"link-name"</a>")
 )
 
 ;; @syntax (Dragonfly:link_to <link_name> <url>)
 		(if (starts-with request-url "/") (pop request-url))
 		(push "/?" request-url)
 	)
+	(set 'request-url (web-root request-url))
 	(print "var ajax"html-elementid" = new AjaxRequest(\""request-url"\", responseFunction);")
 	
 	(print "ajax"html-elementid".post(\""params-url"\");")