Anonymous avatar Anonymous committed 340f02d

[svn] * Adding simplejson req, adding use of json'ification. Updated scriptaculous
helpers to split out JS generation for use in JS Generation port.

Comments (0)

Files changed (3)

 WebHelpers ChangeLog
 
 0.2 (**svn**)
+* Adding simplejson req, adding use of json'ification. Updated scriptaculous
+  helpers to split out JS generation for use in JS Generation port.
 * Finished sync'ing Rails ports (urls, tags) in WebHelpers. Closes #69.
   url and prototype tests updated, url helpers updated to handle method
   argument.
     zip_safe=False,
     include_package_data=True,
     install_requires=[
-        "Routes>=1.1",
+        "Routes>=1.1", "simpljson>=1.4",
         ],
     classifiers=["Development Status :: 4 - Beta",
                  "Intended Audience :: Developers",

webhelpers/rails/scriptaculous.py

     You can change the behaviour with various options, see
     http://script.aculo.us for more documentation.
     """
+    return javascript_tag(sortable_element_js(element_id, **options))
+
+def sortable_element_js(element_id, **options):
     options.setdefault('with', "Sortable.serialize('%s')" % element_id)
     options.setdefault('onUpdate', "function(){%s}" % remote_function(**options))
     for k in options.keys():
     if options.has_key('only'):
         options['only'] = array_or_string_for_javascript(options['only'])
     
-    return javascript_tag("Sortable.create('%s', %s)" % (element_id, options_for_javascript(options)))
+    return "Sortable.create('%s', %s)" % (element_id, options_for_javascript(options))
 
 def draggable_element(element_id, **options):
     """
     You can change the behaviour with various options, see
     http://script.aculo.us for more documentation.
     """
-    return javascript_tag("new Draggable('%s', %s)" % (element_id, options_for_javascript(options)))
+    return javascript_tag(draggable_element_js(element_id, **options))
+
+def draggable_element_js(element_id, **options):
+    return "new Draggable('%s', %s)" % (element_id, options_for_javascript(options))
 
 def drop_receiving_element(element_id, **options):
     """
     You can change the behaviour with various options, see
     http://script.aculo.us for more documentation.    
     """
+    return javascript_tag(drop_receiving_element_js(element_id, **options))
+
+def drop_receiving_element_js(element_id, **options):
     options.setdefault('with', "'id=' + encodeURIComponent(element.id)")
     options.setdefault('onDrop', "function(element){%s}" % remote_function(**options))
     for k in options.keys():
     if options.has_key('hoverclass'):
         options['hoverclass'] = "'%s'" % options['hoverclass']
     
-    return javascript_tag("Droppables.add('%s', %s)" % (element_id, options_for_javascript(options)))
+    return "Droppables.add('%s', %s)" % (element_id, options_for_javascript(options))
 
 __all__ = ['visual_effect', 'parallel_effects', 'sortable_element', 'draggable_element', 'drop_receiving_element']
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.