Author: vbaumann
Date: Thu Nov 17 11:50:53 2005
New Revision: 1865

Added:
   azax/trunk/demos/azaxdemo/browser/azax_instant_edit.azax
   azax/trunk/demos/azaxdemo/browser/azax_instant_edit.pt
Modified:
   azax/trunk/demos/azaxdemo/azaxview.py
   azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt
   azax/trunk/demos/azaxdemo/configure.zcml
Log:
added new demo: instant edit

Modified: azax/trunk/demos/azaxdemo/azaxview.py
==============================================================================
--- azax/trunk/demos/azaxdemo/azaxview.py       (original)
+++ azax/trunk/demos/azaxdemo/azaxview.py       Thu Nov 17 11:50:53 2005
@@ -76,3 +76,19 @@
         return_object = AzaxResponse(self.request.response)
         return_object.setHtmlAsChild('div#update-area', "<p>%s</p>" % 
str(datetime.now()))
         return return_object()
+        
+    def getInputField(self, value):
+        """ returns the current time """
+        return_object = AzaxResponse(self.request.response)
+        return_object.setHtmlAsChild('div#text', 
+                                                '<input type="text" 
name="value" value="'+value+'" />'
+                                                )
+        return return_object()
+        
+    def saveText(self, value):
+        """ returns the current time """
+        return_object = AzaxResponse(self.request.response)
+        return_object.setHtmlAsChild('div#text', value+'<input type="hidden" 
name="value" value="'+value+'" />')
+        return return_object()
+
+

Modified: azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt
==============================================================================
--- azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt        (original)
+++ azax/trunk/demos/azaxdemo/browser/azax_demo_index.pt        Thu Nov 17 
11:50:53 2005
@@ -5,7 +5,8 @@
     <ul>
      <li><a href="demo1.html">Change tag content</a></li>
      <li><a href="two_selects.html">Two selects</a></li>
-     <li><a href="three_autoupdate.html">Three autoupdate</a></li>
+     <li><a href="three_autoupdate.html">Three autoupdate</a></li>
+     <li><a href="azax_instant_edit.html">instant edit</a></li>
     </ul>
   </body>
 </html>

Added: azax/trunk/demos/azaxdemo/browser/azax_instant_edit.azax
==============================================================================
--- (empty file)
+++ azax/trunk/demos/azaxdemo/browser/azax_instant_edit.azax    Thu Nov 17 
11:50:53 2005
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<rules>
+  <rule selector="div#text">
+    <event name="click">getInputField</event>
+  </rule>
+  <rule selector="input#save">
+    <event name="click">saveText</event>
+  </rule>
+</rules>

Added: azax/trunk/demos/azaxdemo/browser/azax_instant_edit.pt
==============================================================================
--- (empty file)
+++ azax/trunk/demos/azaxdemo/browser/azax_instant_edit.pt      Thu Nov 17 
11:50:53 2005
@@ -0,0 +1,35 @@
+<html>
+  <head>
+    <link rel="kukit"
+          tal:attributes="href 
string:${context/absolute_url}/++resource++azax_instant_edit.azax"/>
+    <script type="text/javascript"
+      tal:attributes="src 
string:${context/absolute_url}/++resource++sarissa.js;"
+      src="++resource++sarissa.js">
+    </script>
+    <script type="text/javascript"
+      tal:attributes="src 
string:${context/absolute_url}/++resource++cssQuery.js;"
+      src="++resource++cssQuery.js">
+    </script>
+    <script type="text/javascript"
+      tal:attributes="src 
string:${context/absolute_url}/++resource++MochiKit.js;"
+      src="++resource++MochiKit.js">
+    </script>
+    <script type="text/javascript"
+      tal:attributes="src string:${context/absolute_url}/++resource++kukit.js;"
+      src="++resource++kukit.js">
+    </script>
+</head>
+  <body>
+    <p><a href=".">All demos</a></p>
+
+<h3>Instant edit Demo</h3>
+   <form name="edit">
+        <div id="text">
+        click me!
+        <input type="hidden" name="value" value="click me!"  />
+        </div>
+        <br />
+        <input type="button" value="save" id="save" />
+    </form>
+  </body>
+</html>

Modified: azax/trunk/demos/azaxdemo/configure.zcml
==============================================================================
--- azax/trunk/demos/azaxdemo/configure.zcml    (original)
+++ azax/trunk/demos/azaxdemo/configure.zcml    Thu Nov 17 11:50:53 2005
@@ -127,6 +127,36 @@
       attribute="getCurrentTime"
       name="getCurrentTime"
       permission="zope2.View"
+      />
+      
+      
+  <!-- instant edit content -->
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      template="browser/azax_instant_edit.pt"
+      name="azax_instant_edit.html"
+      permission="zope2.View"
+      />
+
+  <browser:resource
+    file="browser/azax_instant_edit.azax"
+    name="azax_instant_edit.azax"
+  />
+
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      class=".azaxview.AzaxView"
+      attribute="getInputField"
+      name="getInputField"
+      permission="zope2.View"
+      />
+      
+  <browser:page
+      for=".interfaces.ISimpleContent"
+      class=".azaxview.AzaxView"
+      attribute="saveText"
+      name="saveText"
+      permission="zope2.View"
       />
 
 </configure>
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to