Changes between Initial Version and Version 1 of AjaxHelpers


Ignore:
Timestamp:
Jun 29, 2007, 6:14:27 AM (17 years ago)
Author:
joaoma@…
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AjaxHelpers

    v1 v1  
     1=== What is it? ===
     2
     3    * Attached is an adaptation of the port of RoR's JavascriptHelpers (http://pylonshq.com/project/pylons/browser/RailsHelpers) by Ben Bangert to Django tag library.
     4
     5    * It also includes port of Eugene's LiveFilter?(dojo) to prototype (DelayedObserver in observer.js).
     6
     7=== Usage ===
     8
     9{{{
     10{% rails function_name (arg1,arg2,kwarg1=3,...) %}
     11
     12        or
     13   
     14{% rails function_name %}
     15arg1,arg2,
     16arg3,
     17kwarg1=value1,
     18kwarg2=value2,
     19 ...
     20{% endrails %}
     21}}}
     22
     23=== Usage Examples ===
     24
     25{{{
     26{% load railshelper %}
     27
     28{% rails link_to_function ("Greeing", "alert('Hello World')") %}
     29
     30{% rails link_to_remote %}
     31"Delete this post",
     32{'update':"posts",'url':"./destroy"}
     33{% endrails %}
     34
     35{% rails observe_form %}
     36"searchform",
     37url='?format=ahah',
     38update='results',
     39delay=0.3,
     40method='get',
     41complete="SEL.setup('product_list');",
     42{% endrails %}
     43}}}
     44
     45=== Issues ===
     46
     47    * Used exec to do the parameter parsing. So people may not like it, but this was the quickest way I could think of. External parameter is exec-ed only within a function argument:
     48
     49      def argparser(*args, **kws):
     50          return args, kws
     51      exec("args, kws=argparser("+param+")")
     52
     53      I could not think of any malicious thing to do in function argument but probably there are many. Please let me know.
     54
     55    * Easily modifiable to render passed parameter as django template.
     56    * Tested only "link_to_remote", "observe_form" in real web browser (IE, FF, Opera).
Back to Top