Ok i have tracked ti down to the method below. The 2nd last line gets
the label but how can i substitute it for a vaue of the current record
in the row?
JB
def render_action_link(link, url_options)
url_options = url_options.clone
url_options[:action] = link.action
url_options[:controller] = link.controller if link.controller
url_options.delete(:search) if link.controller and
link.controller.to_s != params[:controller]
url_options.merge! link.parameters if link.parameters
html_options = link.html_options.merge({:class =>
link.action})
if link.inline?
# NOTE this is in url_options instead of html_options on
purpose. the reason is that the client-side
# action link javascript needs to submit the proper method,
but the normal html_options[:method]
# argument leaves no way to extract the proper method from
the rendered tag.
url_options[:_method] = link.method
if link.method != :get and respond_to?
(:protect_against_forgery?) and protect_against_forgery?
url_options[:authenticity_token] = form_authenticity_token
end
# robd: protect against submitting get links as forms, since
this causes annoying
# 'Do you wish to resubmit your form?' messages whenever you
go back and forwards.
elsif link.method != :get
# Needs to be in html_options to as the adding _method to
the url is no longer supported by Rails
html_options[:method] = link.method
end
html_options[:confirm] = link.confirm if link.confirm?
html_options[:position] = link.position if link.position and
link.inline?
html_options[:class] += ' action' if link.inline?
html_options[:popup] = true if link.popup?
html_options[:id] = action_link_id(url_options
[:action],url_options[:id] || url_options[:parent_id])
if link.dhtml_confirm?
html_options[:class] += ' action' if !link.inline?
html_options[:page_link] = 'true' if !link.inline?
html_options[:dhtml_confirm] = link.dhtml_confirm.value
html_options[:onclick] = link.dhtml_confirm.onclick_function
(controller,action_link_id(url_options[:action],url_options[:id] ||
url_options[:parent_id]))
end
html_options[:class] += " #{link.html_options[:class]}" unless
link.html_options[:class].blank?
# issue 260, use url_options[:link] if it exists. This
prevents DB data from being localized.
label = url_options.delete(:link) || link.label
link_to label, url_options, html_options
end
On Feb 13, 5:16 am, Kenny Ortmann <[email protected]> wrote:
> overriding the partial would probably be your best bet
>
> On Thu, Feb 12, 2009 at 2:05 PM, johnnybutler7 <[email protected]>wrote:
>
>
>
> > Hi,
>
> > I have a the following below to give me a assocation link to invoices
> > from the client grid.
>
> > config.nested.add_link "Invoices", [:invoices]
> > config.columns[:invoices].association.reverse = :
>
> > What is the best way to get this link "Invoices" dynamic so its
> > customised to the current record in the list grid. So "Client 1
> > Invoices" and "Client 2 Invoices" where "Client 1" and "Client 2" are
> > replace with client.name.
>
> > The only way i can think is to overwrite the partial that deals with
> > this.
>
> > Anybody got a solution??
>
> > JB
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---