nested content_tag link, span, image

hi,

i'm trying to render this html:

<a class="big_button" title="clear" href="cart/clear">
<span>clear cart !
<img alt="arrow" src="img/clear.png"/>
</span>
</a>

the best i can do is:

<%= link_to content_tag(:span, image_tag("img/clear.png", :alt =>
'arrow')), clear_cart_path, :class => "big_button", :title => "clear"
-%>

any ideas???

cheers.

Michael Delaney wrote:

hi,

i'm trying to render this html:

<a class="big_button" title="clear" href="cart/clear">
<span>clear cart !
<img alt="arrow" src="img/clear.png"/>
</span>
</a>

the best i can do is:

<%= link_to content_tag(:span, image_tag("img/clear.png", :alt =>
'arrow')), clear_cart_path, :class => "big_button", :title => "clear"
-%>

any ideas???

cheers.

First, I'd move the content_tag code into a helper.

def clear_cart_button
    content_tag(:span, 'clear cart !' + image_tag("img/clear.png", :alt
=> 'arrow'))
end

Then in your view...

<%= link_to clear_cart_button, clear_cart_path, :class => "big_button",
:title => "clear" %>

Assuming you've added the clear_cart named route, that should work.