El Friday 12 December 2008 22:11:45 harv escribió:
> I currently add some custom links *above* an active scaffold using a
> method from a plugin like this:
>
> <%= plugin_method_creates_links({:id => section.id}) %>
> <%= render :active_scaffold => 'section', :label => "Section"} %>
>
> So the links generated by the plugin are completely separate from the
> scaffold, but act upon the data the scaffold does.
>
> These links have an onClick() event that calls a JavaScript function -
> something like...
> <a ... onClick(javascript:doWhatIWant(105))>Do</a>
> ...where the 105 comes from the :id param passed into the
> plugin_method_creates_links() method
>
> What I really need is to have these links appear *next to* the
> standard scaffold "Create" link, within the scaffold.
>
> I looked at the action_links docs, but see no way to invoke the plugin
> method I need to use. For that matter, I don't see how to use them to
> create the links I need at all - even if I forget the plugin and do it
> myself. I don't see how to say "I want the onClick event of this link
> to call the doWhatIWant() JS function, passing in the current
> section's id.
>
> Can anyone suggest how I might proceed?!
>
> I was looking at overrides - is there a way overrides could be used
> here. It doesn't look like it to me.
>

Usually the best is a link to an action which responds to html and ajax 
requests:
config.action_links.add 'action_name', :type => :table, :parameters => {:id => 
105}
In your controller use respond_to to render a different response to html and 
ajax requests.

You can use html_options to set onclick too:
config.action_links.add 'action_name', :type => :table, :html_options => 
{:onclick => "doWhatIWant(105)"}

-- 
Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
Nicolás Guillén 6, locales 2 y 3. 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---

  • Cu... harv
    • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
      • ... harv
        • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
          • ... harv
            • ... harv
              • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.
                • ... Tim Uckun
            • ... Sergio Cambra .:: entreCables - Symbol Servicios Informáticos S.L. ::.

Reply via email to