Commits

Anonymous committed 0272697

[svn]

Comments (0)

Files changed (3)

 WebHelpers ChangeLog
 
 0.2 (**svn**)
+* Sync'd scriptaculous helper.
 * Sync'd javascript, prototype helpers and prototype.js to latest Rails
   modifications. Added more prototype tests.
 * Sync'd form_options, form_tag helpers. form_tag's form function can now

tests/test_scriptaculous.py

         self.assertEqual("new Effect.Fade('fademe',{duration:4.0});", visual_effect('fade', "fademe", duration=4.0))
         self.assertEqual("new Effect.Shake(element,{});", visual_effect('shake'))
         self.assertEqual("new Effect.DropOut('dropme',{queue:'end'});", visual_effect('drop_out', 'dropme',queue='end'))
+        self.assertEqual("new Effect.DropOut('dropme',{queue:{scope:'test',limit:2,position:'end'}});",  
+            visual_effect('drop_out', 'dropme', queue=dict(position="end",scope="test", limit=2)))
+        self.assertEqual("new Effect.DropOut('dropme',{queue:{scope:'list',limit:2}});",
+            visual_effect('drop_out', 'dropme', queue=dict(scope='list',limit=2)))
+        self.assertEqual("new Effect.DropOut('dropme',{queue:{scope:'test',limit:2,position:'end'}});",  
+            visual_effect('drop_out', 'dropme', queue=dict(position='end',scope='test',limit=2)))
     
     def test_toggle_effects(self):
         self.assertEqual("Effect.toggle('posts','appear',{});", visual_effect("toggle_appear", "posts"))

webhelpers/rails/scriptaculous.py

 See the documentation at http://script.aculo.us for more information on
 using these helpers in your application.
 """
+# Last synced with Rails copy at Revision 3772 on Aug 19th, 2006.
+
 from prototype import *
 from javascript import options_for_javascript, array_or_string_for_javascript
 from prototype import AJAX_OPTIONS, javascript_tag
     http://script.aculo.us for more documentation.
     """
     element = (element_id and "'%s'" % element_id) or "element"
-    if js_options.has_key('queue'):
+    if isinstance(js_options.get('queue'), dict):
+        js_options['queue'] = '{%s}' % ','.join(["%s:%s" % (k,(k == 'limit' and v) or "'%s'" % v) for k,v in js_options['queue'].iteritems()])
+    elif js_options.has_key('queue'):
         js_options['queue'] = "'%s'" % js_options['queue']
+    
+    
     if 'toggle' in name:
         return "Effect.toggle(%s,'%s',%s);" % (element, name.replace('toggle_',''), options_for_javascript(js_options))
     return "new Effect.%s(%s,%s);" % (camelize(name), element, options_for_javascript(js_options))
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.