[xiph-commits] r13209 - in trunk/icebreaker/Icebreaker: . icebreaker icebreaker/templates

nickmudd at svn.xiph.org nickmudd at svn.xiph.org
Fri Jun 29 22:56:00 PDT 2007


Author: nickmudd
Date: 2007-06-29 22:55:59 -0700 (Fri, 29 Jun 2007)
New Revision: 13209

Modified:
   trunk/icebreaker/Icebreaker/devdata.sqlite
   trunk/icebreaker/Icebreaker/icebreaker/controllers.py
   trunk/icebreaker/Icebreaker/icebreaker/controllers.pyc
   trunk/icebreaker/Icebreaker/icebreaker/templates/create.kid
   trunk/icebreaker/Icebreaker/icebreaker/templates/create.pyc
Log:
got selectshuttle form running


Modified: trunk/icebreaker/Icebreaker/devdata.sqlite
===================================================================
(Binary files differ)

Modified: trunk/icebreaker/Icebreaker/icebreaker/controllers.py
===================================================================
--- trunk/icebreaker/Icebreaker/icebreaker/controllers.py	2007-06-29 22:51:01 UTC (rev 13208)
+++ trunk/icebreaker/Icebreaker/icebreaker/controllers.py	2007-06-30 05:55:59 UTC (rev 13209)
@@ -3,6 +3,7 @@
 from turbogears import identity, redirect
 from cherrypy import request, response
 from icebreaker import json
+
 import logging
 log = logging.getLogger("icebreaker.controllers")
 
@@ -52,13 +53,18 @@
     @expose(template="icebreaker.templates.create")
     def create(self):
         from model import data
+        from selectshuttle.widgets import SelectShuttle
         return dict(data=data.select())
-        title_available="Tracks"
-        title_selected="Playlist"
-        btn_all_selected="All>>"        
-        btn_all_available="all available"
-        btn_available="available"
-        btn_selected="selected"
-        btn_to_selected="to selected"
-        btn_to_available="to available"
-        name = "Select Shuttle"
+        form_name="foo"
+        create = SelectShuttle(
+        name="select_shuttle_demo",
+        label = "The shuttle",
+        title_available = "Available options",
+        title_selected = "Selected options",
+        form_reference = "document.forms['%s']" % form_name,
+        # All data should be provided as a list of tuples, in the form of
+        # ("id", "value"). ATM, id should be an int
+        available_options = [(i, "Option %d"%i) for i in xrange(5)],
+        default = dict(selected=[(i, "Option %d"%i) for i in xrange(3)])
+        )
+

Modified: trunk/icebreaker/Icebreaker/icebreaker/controllers.pyc
===================================================================
(Binary files differ)

Modified: trunk/icebreaker/Icebreaker/icebreaker/templates/create.kid
===================================================================
--- trunk/icebreaker/Icebreaker/icebreaker/templates/create.kid	2007-06-29 22:51:01 UTC (rev 13208)
+++ trunk/icebreaker/Icebreaker/icebreaker/templates/create.kid	2007-06-30 05:55:59 UTC (rev 13209)
@@ -5,63 +5,27 @@
   <title>Welcome to TurboGears</title>
 </head>
 <body>
-<div xmlns:py='http://purl.org/kid/ns#'>
-    <script type="text/javascript">
-    var ${optrans_name} = new OptionTransfer('${name}.${available.name}', '${name}.${selected.name}');
-    ${optrans_name}.setAutoSort(true);
-    ${optrans_name}.saveNewLeftOptions('${name}.available_new');
-    ${optrans_name}.saveAddedLeftOptions('${name}.available_added');
-    ${optrans_name}.saveRemovedLeftOptions('${name}.available_removed');
-    ${optrans_name}.saveNewRightOptions('${name}.selected_new');
-    ${optrans_name}.saveAddedRightOptions('${name}.selected_added');
-    ${optrans_name}.saveRemovedRightOptions('${name}.selected_removed');
-    </script>
-    ${display_field_for(available_new)}
-    ${display_field_for(available_added)}
-    ${display_field_for(available_removed)}
-    ${display_field_for(selected_new)}
-    ${display_field_for(selected_added)}
-    ${display_field_for(selected_removed)}
-    <table align='left' width='100%' class='selectshuttle'>
-      <thead>
-        <tr>
-          <th class='selectshuttle-left' py:content='title_available'>Left Options</th>
-          <th class='selectshuttle-middle'></th>
-          <th class='selectshuttle-right' py:content='title_selected'>Right Options</th>
-        </tr>
-      </thead>
-      <tbody>
-        <tr>
-          <td class='selectshuttle-left'>${display_field_for(available)}</td>
-          <td class='selectshuttle-middle'>
-            <input type="button" name="btn_selected" id="${optrans_name}_btn_selected" py:attrs="value=btn_to_selected" onclick="${optrans_name}.transferRight()" />
-            <br />
-            <br />
-            <input type="button" name="btn_all_selected" id="${optrans_name}_btn_all_selected" py:attrs="value=btn_all_selected" onclick="${optrans_name}.transferAllRight()" />
-            <br />
-            <br />
-            <input type="button" name="btn_all_available" id="${optrans_name}_btn_all_available" py:attrs="value=btn_all_available" onclick="${optrans_name}.transferAllLeft()" />
-            <br />
-            <br />
-            <input type="button" name="btn_available" id="${optrans_name}_btn_available" py:attrs="value=btn_to_available" onclick="${optrans_name}.transferLeft()" />
-          </td>
-          <td class='selectshuttle-right'>${display_field_for(selected)}</td>
-        </tr>
-        <tr py:if='add_link is not None'>
-          <td class='selectshuttle-addlink' colspan='3'>
-            <a target="${target}" href="${add_link}">
-                <span py:strip="1" py:if="add_image_src is not None">
-                    <img src="${add_image_src}" border="0" />
-                </span>
-                ${add_text}
-            </a>
-          </td>
-        </tr>
-      </tbody>
-    </table>
-    <script type="text/javascript">
-      addLoadEvent(${optrans_name}.init(${form_reference}))
-    </script>
+<?python
+from selectshuttle.widgets import SelectShuttle
+form_name="foo"
+create = SelectShuttle(
+name="select_shuttle_demo",
+label = "The shuttle",
+title_available = "Available options",
+title_selected = "Selected options",
+form_reference = "document.forms['%s']" % form_name,
+# All data should be provided as a list of tuples, in the form of
+# ("id", "value"). ATM, id should be an int
+available_options = [(i, "Option %d"%i) for i in xrange(5)],
+default = dict(selected=[(i, "Option %d"%i) for i in xrange(3)])
+)
+?>
+<div>
+    <form action="%s/post_data" name="%s" method="POST">
+        ${create.display()}
+        <br />
+        <input type="submit" value="Submit" />
+    </form>
 </div>
 </body>
 </html>

Modified: trunk/icebreaker/Icebreaker/icebreaker/templates/create.pyc
===================================================================
(Binary files differ)



More information about the commits mailing list