Version 1 (modified by joaoma@…, 17 years ago) ( diff )

--

What is it?

  • It also includes port of Eugene's LiveFilter?(dojo) to prototype (DelayedObserver in observer.js).

Usage

{% rails function_name (arg1,arg2,kwarg1=3,...) %}

        or
    
{% rails function_name %}
arg1,arg2,
arg3,
kwarg1=value1,
kwarg2=value2,
 ...
{% endrails %}

Usage Examples

{% load railshelper %}

{% rails link_to_function ("Greeing", "alert('Hello World')") %}

{% rails link_to_remote %}
"Delete this post", 
{'update':"posts",'url':"./destroy"}
{% endrails %}

{% rails observe_form %}
"searchform",
url='?format=ahah', 
update='results',
delay=0.3,
method='get',
complete="SEL.setup('product_list');",
{% endrails %}

Issues

  • 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:

def argparser(*args, kws):

return args, kws

exec("args, kws=argparser("+param+")")

I could not think of any malicious thing to do in function argument but probably there are many. Please let me know.

  • Easily modifiable to render passed parameter as django template.
  • Tested only "link_to_remote", "observe_form" in real web browser (IE, FF, Opera).
Note: See TracWiki for help on using the wiki.
Back to Top