Greg Slepak avatar Greg Slepak committed 7b7c133

convert ajax demo and link_to to use web-root

Comments (0)

Files changed (3)

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
 ;===============================================================================

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)
 )
 

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"\");")
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.