Title: [waffle-scm] [307] trunk/examples/jruby-example/resources: updated person.rhtml example to utilize partial page (ERB)

Diff

Modified: trunk/core/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java (306 => 307)

--- trunk/core/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/core/src/main/java/org/codehaus/waffle/servlet/RhtmlServlet.java	2007-08-10 14:32:36 UTC (rev 307)
@@ -58,6 +58,7 @@
     }
 
     private String loadRhtml(String fileName) {
+        System.out.println("Loading...." + fileName);
         BufferedReader bufferedReader = null;
         InputStream inputStream = null;
 

Added: trunk/examples/jruby-example/resources/edit_person.rhtml (0 => 307)

--- trunk/examples/jruby-example/resources/edit_person.rhtml	                        (rev 0)
+++ trunk/examples/jruby-example/resources/edit_person.rhtml	2007-08-10 14:32:36 UTC (rev 307)
@@ -0,0 +1,30 @@
+<div class="editContainer">
+
+  <h3>Edit Person</h3>
+
+  <div class="fieldRow">
+    <label for=""
+    <input type="text" name="person.id" id="person.id" value="<[EMAIL PROTECTED] %>" readonly="true" disabled="true"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for="" Name:</label>
+    <input type="text" name="person.firstName" id="person.firstName" value="<[EMAIL PROTECTED] %>"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for="" Name:</label>
+    <input type="text" name="person.lastName" id="person.lastName" value="<[EMAIL PROTECTED] %>"/>
+    <br style="clear:both"/>
+  </div>
+  <div class="fieldRow">
+    <label for=""
+    <input type="text" name="person.email" id="person.email" value="<[EMAIL PROTECTED] %>"/>
+    <br style="clear:both"/>
+  </div>
+
+  <br/>
+  <a href="" |
+  <a href=""
+
+</div>
\ No newline at end of file

Deleted: trunk/examples/jruby-example/resources/editperson.jspx (306 => 307)

--- trunk/examples/jruby-example/resources/editperson.jspx	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/examples/jruby-example/resources/editperson.jspx	2007-08-10 14:32:36 UTC (rev 307)
@@ -1,51 +0,0 @@
-<div class="editContainer" xmlns="http://www.w3.org/1999/xhtml"
-     xmlns:jsp="http://java.sun.com/JSP/Page"
-     xmlns:c="http://java.sun.com/jsp/jstl/core"
-     xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">
-
-  <h3>Edit Person</h3>
-
-  <!--<c:if test="${errors.errorMessageCount > 0}">
-    <div class="errors">
-      <c:forEach var="error" items="${errors.allErrorMessages}">
-        <div class="error">
-          ${error.message}
-        </div>
-      </c:forEach>
-    </div>
-  </c:if>-->
-
-  <div class="fieldRow">
-    <label for=""
-    <input type="text" name="person.id" id="person.id" value="${person.id}" readonly="true" disabled="true"/>
-    <br style="clear:both"/>
-  </div>
-  <div class="fieldRow">
-    <label for="" Name:</label>
-    <input type="text" name="person.firstName" id="person.firstName" value="${person.firstName}"/>
-    <br style="clear:both"/>
-  </div>
-  <div class="fieldRow">
-    <label for="" Name:</label>
-    <input type="text" name="person.lastName" id="person.lastName" value="${person.lastName}"/>
-    <br style="clear:both"/>
-  </div>
-  <div class="fieldRow">
-    <label for=""
-    <input type="text" name="person.email" id="person.email" value="${person.email}"/>
-    <br style="clear:both"/>
-  </div>
-  <!--<div class="fieldRow">
-    <label for="" of Birth:</label>
-    <fmt:formatDate value="${person.dateOfBirth}" var="birthDate" pattern="dd-MM-yyyy"/>
-    <input type="text" name="person.dateOfBirth" id="person.dateOfBirth" value="${birthDate}"/>
-    <br style="clear:both"/>
-  </div>-->
-
-  <br/>
-  <a href="" |
-  <a href=""
-
-  <!--<jsp:directive.include file="fielderrors.jspx"/>-->
-
-</div>
\ No newline at end of file

Modified: trunk/examples/jruby-example/resources/other.rhtml (306 => 307)

--- trunk/examples/jruby-example/resources/other.rhtml	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/examples/jruby-example/resources/other.rhtml	2007-08-10 14:32:36 UTC (rev 307)
@@ -1,15 +1,15 @@
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 <head>
-	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
+  <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
-	<title>other</title>
-	
+  <title>other</title>
+
 </head>
 
 <body>
-	<h1>The value is: <%= @value %></h1>
+  <h1>The value is: <%= @value %></h1>
 </body>
 </html>

Deleted: trunk/examples/jruby-example/resources/person.jspx (306 => 307)

--- trunk/examples/jruby-example/resources/person.jspx	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/examples/jruby-example/resources/person.jspx	2007-08-10 14:32:36 UTC (rev 307)
@@ -1,63 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<html xmlns="http://www.w3.org/1999/xhtml"
-      xmlns:jsp="http://java.sun.com/JSP/Page"
-      xmlns:c="http://java.sun.com/jsp/jstl/core"
-      xmlns:fmt="http://java.sun.com/jsp/jstl/fmt">
-
-<jsp:output doctype-root-element="html"
-            doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN"
-            doctype-system="http://www.w3c.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>
-<jsp:directive.page contentType="text/html;charset=UTF-8"/>
-
-<head>
-  <title>Select a person</title>
-  <style type="text/css" title="currentStyle" media="screen">
-    @import "stylesheets/style.css";
-  </style>
-  <script src="" type="text/_javascript_">
-    // keep this space
-  </script>
-  <script src="" type="text/_javascript_">
-    // keep this space
-  </script>
-</head>
-
-<body>
-<form action="" method="post">
-
-  <h3>Waffle/JRuby example: Select Person</h3>
-
-  <table>
-    <tr>
-      <th>Id</th>
-      <th>First Name</th>
-      <th>Last Name</th>
-      <th>Email</th>
-      <th>Date of Birth</th>
-    </tr>
-    <c:forEach var="person" items="${persons}" varStatus="status">
-      <tr class="${status.index % 2 eq 0 ? 'even' : 'odd'}">
-        <td>
-          <a href=""
-        </td>
-        <td>${person.firstName}</td>
-        <td>${person.lastName}</td>
-        <td>${person.email}</td>
-        <td><fmt:formatDate value="${person.dateOfBirth}" pattern="MMMMM dd, yyyy"/></td>
-      </tr>
-    </c:forEach>
-  </table>
-
-  <a href=""
-
-  <!-- Example of partial page -->
-  <div id="editArea">
-    <c:if test="${person != null}">
-      <jsp:directive.include file="editperson.jspx"/>
-    </c:if>
-  </div>
-
-</form>
-</body>
-
-</html>
\ No newline at end of file

Modified: trunk/examples/jruby-example/resources/person.rhtml (306 => 307)

--- trunk/examples/jruby-example/resources/person.rhtml	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/examples/jruby-example/resources/person.rhtml	2007-08-10 14:32:36 UTC (rev 307)
@@ -1,16 +1,15 @@
-<html>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+
 <head>
   <title>Persons rhtml listing</title>
   <style type="text/css" title="currentStyle" media="screen">
     @import "stylesheets/style.css";
   </style>
-  <script src="" type="text/_javascript_">
-    // keep this space
-  </script>
-  <script src="" type="text/_javascript_">
-    // keep this space
-  </script>
+  <script src="" type="text/_javascript_"></script>
+  <script src="" type="text/_javascript_"></script>
 </head>
 
 <body>
@@ -27,7 +26,9 @@
     </tr>
     <% @persons.each_with_index do |person, index| %>
       <tr class="<%= index % 2 == 0 ? 'even' : 'odd' %>">
-        <td><%= person.id %></td> <!-- TODO: Override object_id -->
+        <td>
+          <%= %{<a href="" %>
+        </td>
         <td><%= person.firstName %></td>
         <td><%= person.lastName %></td>
         <td><%= person.email %></td>
@@ -35,6 +36,14 @@
       </tr>
     <% end %>
   </table>
+
+  <%# Example of partial page %>
+  <div id='editArea'>
+    <% unless @person.nil? %>
+      <%= partial('edit_person', {:foobar => "Mike"}) %>
+    <% end %>
+  </div>
+
   </form>
 </body>
 

Modified: trunk/examples/jruby-example/src/main/ruby/person.rb (306 => 307)

--- trunk/examples/jruby-example/src/main/ruby/person.rb	2007-08-10 14:30:31 UTC (rev 306)
+++ trunk/examples/jruby-example/src/main/ruby/person.rb	2007-08-10 14:32:36 UTC (rev 307)
@@ -6,7 +6,6 @@
     @person_dao = locate(org.codehaus.waffle.example.jruby.dao.PersonDAO)
 
     @persons = @person_dao.findAll
-    #render 'person.jspx'
     render 'person.rhtml'
   end
 


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to