--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Returns a link of the given <tt>name</tt> that will trigger a JavaScript <tt>function</tt> using the onclick handler and return false after the fact.
- !ruby/struct:SM::Flow::P 
  body: The first argument <tt>name</tt> is used as the link text.
- !ruby/struct:SM::Flow::P 
  body: The next arguments are optional and may include the javascript function definition and a hash of html_options.
- !ruby/struct:SM::Flow::P 
  body: The <tt>function</tt> argument can be omitted in favor of an <tt>update_page</tt> block, which evaluates to a string when the template is rendered (instead of making an Ajax request first).
- !ruby/struct:SM::Flow::P 
  body: The <tt>html_options</tt> will accept a hash of html attributes for the link tag. Some examples are :class =&gt; &quot;nav_button&quot;, :id =&gt; &quot;articles_nav_button&quot;
- !ruby/struct:SM::Flow::P 
  body: "Note: if you choose to specify the javascript function in a block, but would like to pass html_options, set the <tt>function</tt> parameter to nil"
- !ruby/struct:SM::Flow::P 
  body: "Examples:"
- !ruby/struct:SM::Flow::VERB 
  body: "  link_to_function &quot;Greeting&quot;, &quot;alert('Hello world!')&quot;\n    Produces:\n      &lt;a onclick=&quot;alert('Hello world!'); return false;&quot; href=&quot;#&quot;&gt;Greeting&lt;/a&gt;\n\n  link_to_function(image_tag(&quot;delete&quot;), &quot;if (confirm('Really?')) do_delete()&quot;)\n    Produces:\n      &lt;a onclick=&quot;if (confirm('Really?')) do_delete(); return false;&quot; href=&quot;#&quot;&gt;\n        &lt;img src=&quot;/images/delete.png?&quot; alt=&quot;Delete&quot;/&gt;\n      &lt;/a&gt;\n\n  link_to_function(&quot;Show me more&quot;, nil, :id =&gt; &quot;more_link&quot;) do |page|\n    page[:details].visual_effect  :toggle_blind\n    page[:more_link].replace_html &quot;Show me less&quot;\n  end\n    Produces:\n      &lt;a href=&quot;#&quot; id=&quot;more_link&quot; onclick=&quot;try {\n        $(&amp;quot;details&amp;quot;).visualEffect(&amp;quot;toggle_blind&amp;quot;);\n        $(&amp;quot;more_link&amp;quot;).update(&amp;quot;Show me less&amp;quot;);\n      }\n      catch (e) {\n        alert('RJS error:\\n\\n' + e.toString());\n        alert('$(\\&amp;quot;details\\&amp;quot;).visualEffect(\\&amp;quot;toggle_blind\\&amp;quot;);\n        \\n$(\\&amp;quot;more_link\\&amp;quot;).update(\\&amp;quot;Show me less\\&amp;quot;);');\n        throw e\n      };\n      return false;&quot;&gt;Show me more&lt;/a&gt;\n"
full_name: ActionView::Helpers::JavaScriptHelper#link_to_function
is_singleton: false
name: link_to_function
params: (name, *args, &block)
visibility: public
