Title: [waffle-scm] [454] trunk/waffle-core/src/main: Removed remnant copies of waffle action-related js - now superceded by waffle/action.js in waffle-resouces.
Revision
454
Author
mauro
Date
2007-12-08 10:23:06 -0600 (Sat, 08 Dec 2007)

Log Message

Removed remnant copies of waffle action-related js - now superceded by waffle/action.js in waffle-resouces.
Updated docs.

Modified Paths

Removed Paths

Diff

Deleted: trunk/examples/mydvds-example/resources/js/utils.js (453 => 454)

--- trunk/examples/mydvds-example/resources/js/utils.js	2007-12-08 15:59:15 UTC (rev 453)
+++ trunk/examples/mydvds-example/resources/js/utils.js	2007-12-08 16:23:06 UTC (rev 454)
@@ -1,15 +0,0 @@
-function fireMethod(methodName, formId) {
-    form = document.getElementById(formId);
-    createElementSubmitForm(form, methodName);
-}
-
-function createElementSubmitForm(form, methodName) {
-    var method = document.createElement("input");
-    method.setAttribute("type", "hidden");
-    method.setAttribute("name", "method");
-    method.value = methodName;
-
-    form.appendChild(method);
-    form.submit();
-    return true;
-}
\ No newline at end of file

Modified: trunk/waffle-distribution/src/site/content/action-methods.html (453 => 454)

--- trunk/waffle-distribution/src/site/content/action-methods.html	2007-12-08 15:59:15 UTC (rev 453)
+++ trunk/waffle-distribution/src/site/content/action-methods.html	2007-12-08 16:23:06 UTC (rev 454)
@@ -54,9 +54,9 @@
   <textarea class="html:nogutter:nocontrols" name="code">
     <a href="" football</a>
 
-    <input type="button" value="Buy football" 
+    <input type="button" value="Buy football" 
 
-    <a href="" football</a>
+    <a href="" football</a>
   </textarea>
 
   <p>Notice that the second argument <b>{quantity}</b> is wrapped between curly brackets which signals that Waffle will
@@ -79,29 +79,51 @@
   </p>
 
   <dl>
-    <dt>Note:</dt>
-    <dd>
-      Use this _javascript_ to dynamically add a "method" parameter to your form before submitting the form.
+    <dt><b>Note:</b></dt>
+    <dd>The _javascript_ to fire an action method is contained in waffle-resources jar and can be simply unpacked in webapp.  
+    To use the following needs to be declared:
     </dd>
+    
+      <textarea class="html:nogutter:nocontrols" name="code">
+    <script src="" type="text/_javascript_">
+        // keep this space
+    </script>
+     </textarea>
+     
+      The maven-dependency-plugin makes it easy to unpack the content of the waffle-resources jar to the
+      webapp context:
+
+      <textarea class="xml:nogutter:nocontrols" name="code">
+     <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-dependency-plugin</artifactId>
+         <executions>
+           <execution>
+             <id>unpack-resources</id>
+             <phase>process-resources</phase>
+             <goals>
+               <goal>unpack</goal>
+             </goals>
+             <configuration>
+               <outputDirectory>
+                 ${project.build.directory}/${pom.artifactId}-${pom.version}
+               </outputDirectory>
+               <overWriteReleases>false</overWriteReleases>
+               <overWriteSnapshots>true</overWriteSnapshots>
+               <artifactItems>
+                 <artifactItem>
+                   <groupId>org.codehaus.waffle</groupId>
+                   <artifactId>waffle-resources</artifactId>
+                   <version>[chosen version]</version>
+                 </artifactItem>
+               </artifactItems>
+             </configuration>
+           </execution>
+         </executions>
+       </plugin>
+      </textarea>
   </dl>
 
-  <textarea class="js:nogutter:nocontrols" name="code">
-    function fireMethod(methodName) {
-      createElementSubmitForm(document.forms[0], methodName);
-    }
-
-    function createElementSubmitForm(form, methodName) {
-        var method = document.createElement("input");
-        method.setAttribute("type", "hidden");
-        method.setAttribute("name", "method");
-        method.value = methodName;
-
-        form.appendChild(method);
-        form.submit();
-        return true;
-    }
-  </textarea>
-
   <h3>The ActionMethod annotation (default)</h3>
 
   <p>

Modified: trunk/waffle-distribution/src/site/content/examples/simple-calculator.html (453 => 454)

--- trunk/waffle-distribution/src/site/content/examples/simple-calculator.html	2007-12-08 15:59:15 UTC (rev 453)
+++ trunk/waffle-distribution/src/site/content/examples/simple-calculator.html	2007-12-08 16:23:06 UTC (rev 454)
@@ -117,9 +117,9 @@
       <br style="clear:both"/>
     </div>
 
-    <a href="" |
-    <a href="" |
-    <a href=""
+    <a href="" |
+    <a href="" |
+    <a href=""
 
   &lt;/form&gt;
   &lt;/body&gt;

Modified: trunk/waffle-resources/src/main/resources/js/waffle/action.js (453 => 454)

--- trunk/waffle-resources/src/main/resources/js/waffle/action.js	2007-12-08 15:59:15 UTC (rev 453)
+++ trunk/waffle-resources/src/main/resources/js/waffle/action.js	2007-12-08 16:23:06 UTC (rev 454)
@@ -12,6 +12,11 @@
     submitInputMethod(form, methodName);
 }
 
+function fireActionMethod(methodName, formId) {
+    var form = document.getElementById(formId);
+    submitInputMethod(form, methodName);
+}
+
 function fireMultipartActionMethod(methodName) {
 	var form = document.forms[0];
 	form.method="post";
@@ -19,6 +24,13 @@
 	submitInputMethod(form, methodName);
 }
 
+function fireMultipartActionMethod(methodName, formId) {
+    var form = document.getElementById(formId);
+    form.method="post";
+    form.encoding="multipart/form-data";
+    submitInputMethod(form, methodName);
+}
+
 function submitInputMethod(form, methodName) {
     var method = document.createElement("input");
     method.setAttribute("type", "hidden");


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to