Greg Slepak avatar Greg Slepak committed 660929f Merge

Comments (0)

Files changed (6)

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

 ; !RSS Functions
 ;===============================================================================
 
-;; @syntax (read-atom-feed <feed-url>, <raw-xml>)
+;; @syntax (read-atom-feed <feed-url> <raw-xml>)
 ;; @param <feed-url> a string containing the URL to the ATOM feed
 ;; @param <raw-xml> BOOLEAN, if true raw XML is send right back and there's no parsing
 ;; <p>Reads an atom feed from a given URL and displays it. There are three span classes to style Your feed:
 ;; atomFeedTitle, atomFeedUpdated and atomFeedAuthor.</p>
 
-(define (read-atom-feed feed-url, raw-xml)
+(define (read-atom-feed feed-url raw-xml)
 
 	; get feed-url
 	(set 'xml (get-url (string feed-url) ))
 )
 
 
-;; @syntax (read-rss-feed <feed-url>, <raw-xml>)
+;; @syntax (read-rss-feed <feed-url> <raw-xml>)
 ;; @param <feed-url> a string containing the URL to the RSS feed
 ;; @param <raw-xml> BOOLEAN, if true raw XML is send right back and there's no parsing
 ;; <p>Reads an RSS feed from a given URL and displays it. There are three span classes to style Your feed:
 ;; rssFeedTitle, rssFeedUpdated and rssFeedAuthor.</p>
 
-(define (read-rss-feed feed-url, raw-xml)
+(define (read-rss-feed feed-url raw-xml)
 
 	; get feed-url
 	(set 'xml (get-url (string feed-url) ))

example-site/includes/css/screen.css

 		padding:0;
 		empty-cells:show;
 		border-spacing:0px;
-		background-color:#ffffff;
+		border-right: 1px solid #999;
+		border-bottom: 1px solid #999;
+		border-top: 1px solid #999;
+		background-color:#fff;
 	}
 
 	table th {
 		padding-left:10px;
 	}
 
+	table tr.header {
+		background-color: #DDD;
+	}
+	
+	table tr.header td {
+		border-bottom: 1px solid #999;
+		font-weight: bold;
+	}
+	
 	table td {
 		font-size:10px;
 		padding-top:4px;
 		padding-bottom:4px;		
-		padding-left:10px;
-		border-left:1px solid #000000;
-		border-bottom:1px solid #000000;		
+		padding-left:8px;
+		padding-right:8px;
+		border-left: 1px solid #999;
 	}
 
 	.table_foot {
Add a comment to this file

example-site/includes/images/rails_rest.png

Added
New image
Add a comment to this file

example-site/includes/images/rails_rest_fix.png

Added
New image

example-site/views/dragonfly_routes.html

 		<p>
 			<span class="code"><b>format</b></span> (optional) - may only contain letters and can be used to specify the response format. (i.e. xml, json, etc.)
 		</p>
-		
+		<h2>Something missing...?</h2>
+		<p>
+			If you've done RESTful web programming before, you may be asking right now, "But where are the HTTP verbs GET/POST/PUT??"
+		</p>
+		<p>
+			Dragonfly's built-in RESTful route doesn't use them.
+		</p>
+		<p>
+			There are two reasons for this decision:
+		</p>
+		<ol>
+			<li>newLISP's built-in server doesn't set <span class="code">REQUEST_METHOD</span> (currently)</li>
+			<li>Their use is redundant and confusing</li>
+		</ol>
+		<p>
+			To elaborate on point #2, let's take a look at this table (taken from the Ruby on Rails <a href="http://guides.rubyonrails.org/routing.html">routing guide</a>):
+		</p>
+		<p>
+			<img src="<%=(web-root "includes/images/rails_rest.png")%>">
+		</p>
+		<p>It's not at all clear when a verb should be added to the URL or when an HTTP verb needs to be changed.
+		</p>
+		<p>
+			The problem is that two RESTful abstractions are carelessly mixed with each other: HTTP verbs, and verbs in the URL.</p>
+		<p>Whether the RESTful verb in <span class="code">GET /photos/1/edit</span> is "GET" or "edit" is left to philosophical inquiry.</p>
+		<p>
+			Ironically, the "action" column lists quite clearly which verb is being used:
+		</p>
+		<p>
+			<img src="<%=(web-root "includes/images/rails_rest_fix.png")%>">
+		</p>
+		<p>
+			We can now greatly simplify this table:
+		</p>
+		<br/>
+		<table>
+			<tr class="header">
+				<td>URL</td>
+				<td>controller</td>
+				<td>used for</td>
+			</tr>
+			<tr>
+				<td>/photos</td>
+				<td>Resource.Photos</td>
+				<td>display a list of all images</td>
+			</tr>
+			<tr>
+				<td>/photos/new</td>
+				<td>Resource.Photos</td>
+				<td>return an HTML form for creating a new image</td>
+			</tr>
+			<tr>
+				<td>/photos/create</td>
+				<td>Resource.Photos</td>
+				<td>create a new image</td>
+			</tr>
+			<tr>
+				<td>/photos/show/1</td>
+				<td>Resource.Photos</td>
+				<td>display a specific image</td>
+			</tr>
+			<tr>
+				<td>/photos/edit/1</td>
+				<td>Resource.Photos</td>
+				<td>return an HTML form for editing an image</td>
+			</tr>
+			<tr>
+				<td>/photos/update/1</td>
+				<td>Resource.Photos</td>
+				<td>update a specific image</td>
+			</tr>
+			<tr>
+				<td>/photos/destroy/1</td>
+				<td>Resource.Photos</td>
+				<td>delete a specific image</td>
+			</tr>
+		</table>
 		<h3 class="code">Example resource in resources/wings.lsp:</h3>
 		<pre class="code">
 (DF:activate-plugin "artfulcode/json")
 			<div id="wings_resp" style="width:300px; height:40px; border:1px solid gray; padding:4px; overflow:auto">
 				&nbsp;
 			</div>
+			<div id="wings_request" style="color:#055; font-size:10px; margin-top:6px; font-weight:bold;">(request will be displayed here...)</div>
 			<form id="wings_form">
 				<p>
 					<select id="response_format">
 		<script type="text/javascript" charset="utf-8">
 			var form = $('#wings_form');
 			form.find("input[type='button']").click(function() {
-				var req_url = "<%=(web-root "wings" true)%>" + form.attr('action');
+				var req_url = '<%=(web-root "wings" true)%>';
 				req_url += '/' + $('#wings_id').val();
 				req_url += $('#response_format').val();
+				$('#wings_request').html(req_url);
 				$.ajax({
 					url: req_url,
 					success: function (data, status) {

example-site/views/dragonfly_views.html

 			<p><% (title "| Dragonfly web framework") %><p>
 		</div>
 		
-		<h1>Using Templates</h1>
-		<p class="extract">A view is simply a web page, or a page fragment, like a header or footer. In fact, views can flexibly be embedded within other views. In that case we call them partials.</p>
+		<h1>Templates</h1>
+		<p class="extract">In Dragonfly, templates are files that have newLISP code embedded in them. This code is evaluated server-side, generating a final document that's presented to visitors.</p>
 
-		<h2>How to load a view</h2>
+		<h2>The </h2>
 		<p>Example: open Your favorite text-editor and enter the following:</p>
 		<pre class="code">Hello World</pre>
 		<p>Save the file as "hello" into Your views directory. Now open Your browser and navigate to <a href="http://www.example-site.com/hello">example-site.com/hello</a>. That's it!</p>
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.