Is there a way to get link_to to generate a body-less anchor? I have a CSS sprite which represents an “add” / “remove” button which I use, so I don’t want any body text. For example, I want something similar to this: <a title=‘Add Attachment’ class=‘add_child’ onclick=‘add_asset_row''></a> Using this does not work: <%= link_to ''#'', :url => {:action => ''add_asset_row''}, :title => ''Add attachment'', :class => ''add_child'', :remote => true %> Any suggestions? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> Is there a way to get link_to to generate a body-less anchor?Not sure I understand as what you ask for below isn''t an anchor... ?? But maybe what you want is... link_to_function '''', ''add_asset_row()'', :class => ''add_child'' Or if you really want a remote link just replace that ''#'' with '''' and it should give you an empty link...> I have a CSS sprite which represents an “add” / “remove” button which I > use, so I don’t want any body text. For example, I want something > similar to this: > > <a title=‘Add Attachment’ class=‘add_child’ onclick=‘add_asset_row''></a> > > Using this does not work: > > <%= link_to ''#'', :url => {:action => ''add_asset_row''}, :title => ''Add > attachment'', :class => ''add_child'', :remote => true %> > > Any suggestions? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Philip Hallstrom wrote in post #979207:> Not sure I understand as what you ask for below isn''t an anchor... ?? > > But maybe what you want is... > > link_to_function '''', ''add_asset_row()'', :class => ''add_child'' > > Or if you really want a remote link just replace that ''#'' with '''' and it > should give you an empty link…Using ‘’ with link_to forces it to use the href as the body. But, switching to link_to_function using ‘’ got rid of the body. Thanks for the tip! Now I need to figure out how to get it working with jQuery since I’m not using Prototype... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Edward Stembler wrote in post #979228:> Now I need to figure out how to get it working with jQuery since I’m not > using Prototype…Here’s how I got it to work using jQuery: <%=link_to_function '''', "$(''#asset_rows'').append(''#{escape_javascript render(:partial => ''partials/asset_row'', :locals => {:asset => Asset.new})}'')", :title => ''Add Attachment'', :class => ''add_child'' %> Now on to the “remove” button... -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
if you name your partial partials/rows/asset then you can use :object => Asset.new instead of :locals => ... On Wed, Feb 2, 2011 at 11:22 AM, Edward Stembler <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Edward Stembler wrote in post #979228: >> Now I need to figure out how to get it working with jQuery since I’m not >> using Prototype… > > Here’s how I got it to work using jQuery: > > <%=link_to_function '''', "$(''#asset_rows'').append(''#{escape_javascript > render(:partial => ''partials/asset_row'', :locals => {:asset => > Asset.new})}'')", :title => ''Add Attachment'', :class => ''add_child'' %> > > Now on to the “remove” button... > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- make haste slowly \ festina lente \ - mobile +1_415_632_6001 curtis-DDU1nqEjlGkHaT8GDLgCUg@public.gmane.org http://robotarmyma.de -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.