(This is related to #1262, which is not a bug, so, it should be a wiki entry. However, I can't attach files because Akismet thinks I'm a spammer. Someone please attach here the file that's attached to #1262).

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).
Last modified 17 years ago Last modified on Jun 29, 2007, 8:54:27 AM
Note: See TracWiki for help on using the wiki.
Back to Top