[Checkins] SVN: grokapps/LoginDemo/ added form.pt template to join form

Luciano Ramalho luciano at ramalho.org
Thu Jan 3 11:32:22 EST 2008


Log message for revision 82645:
  added form.pt template to join form

Changed:
  U   grokapps/LoginDemo/README.txt
  U   grokapps/LoginDemo/src/logindemo/app.py
  A   grokapps/LoginDemo/src/logindemo/form.pt

-=-
Modified: grokapps/LoginDemo/README.txt
===================================================================
--- grokapps/LoginDemo/README.txt	2008-01-03 09:23:54 UTC (rev 82644)
+++ grokapps/LoginDemo/README.txt	2008-01-03 16:32:22 UTC (rev 82645)
@@ -27,5 +27,5 @@
 
 - allow manager to delete user accounts through the member listing
 
-- find out the best way to embed auto-generated forms in our master template
+- find out if there is a better way to embed auto-generated forms in our master template
 

Modified: grokapps/LoginDemo/src/logindemo/app.py
===================================================================
--- grokapps/LoginDemo/src/logindemo/app.py	2008-01-03 09:23:54 UTC (rev 82644)
+++ grokapps/LoginDemo/src/logindemo/app.py	2008-01-03 16:32:22 UTC (rev 82645)
@@ -90,16 +90,15 @@
         session.logout(self.request)
         self.redirect(self.application_url())
         
-class Join(grok.AddForm):
+class Join(grok.AddForm, Master):
     """
     User registration form.
     """
     form_fields = grok.AutoFields(IUser)
-    
     # XXX: Failed attempt to display the password_encoding field
     #form_fields[u'password_encoding'].custom_widget = SourceDropdownWidget
-  
     form_title = u'User registration'
+    template = grok.PageTemplateFile('form.pt')
     
     @grok.action('Save')
     def join(self, **data):

Added: grokapps/LoginDemo/src/logindemo/form.pt
===================================================================
--- grokapps/LoginDemo/src/logindemo/form.pt	                        (rev 0)
+++ grokapps/LoginDemo/src/logindemo/form.pt	2008-01-03 16:32:22 UTC (rev 82645)
@@ -0,0 +1,46 @@
+<html metal:use-macro="context/@@master/macros/page">
+<body>
+
+    
+    <div metal:fill-slot="main">
+    
+        <h1 tal:content="view/form_title|string:Form"></h1>
+
+        <form class="edit-form" enctype="multipart/form-data" method="post"
+            action="." tal:attributes="action request/URL">
+        
+        <h1 tal:content="view/label" i18n:translate="">Edit something</h1>
+        
+        <div class="summary" tal:condition="view/status"
+             tal:content="view/status" i18n:translate="">Status</div>
+        
+        <div class="row" tal:repeat="widget view/widgets">
+          <div class="label">
+            <label for="field.name" title="The widget's hint"
+                   tal:attributes="for widget/name; title widget/hint"
+                   tal:content="widget/label" i18n:translate=""
+                   i18n:attributes="title">Label</label>
+          </div>
+        
+          <div tal:condition="widget/error"
+               tal:content="structure widget/error">Error</div>
+        
+          <div class="field">
+            <input tal:replace="structure widget" />
+          </div>
+        </div>
+        
+        <div class="row">
+          <div class="label" />
+          <div class="field">
+            <span class="actionButtons" tal:condition="view/availableActions">
+              <input tal:repeat="action view/actions"
+                     tal:replace="structure action/render"
+                     />
+            </span>
+          </div>
+        </div>    
+        </form>
+    </div>
+</body>
+</html>



More information about the Checkins mailing list