link_to for a button that consists of multiple child divs nested inside?
I have a button that consists of multiple divs inside of it for presentation purposes. Is it possible to declare a link_to for this using Ruby on Rails 3 and jQuery.js and rails.js?
Here is my button with the visual elements completed:
<span id="navButton" class="navButton">
<span class="imageBorderOverlay"&开发者_StackOverflow社区gt;</span>
<span class="navButtonImage"><img src="/images/a.jpg"></span>
<span class="navButtonText">
<span class="navButtonTextBackground">Click Me!</span>
</span>
</span>
Here is my current link_to command that I am using separately (for testing) that works:
<%= link_to "navButton", navA_path(:format => :js), :remote => true, :id => "aPanel" %>
Thank You!
You can pass a block to link_to, so you could do this:
<%= link_to navA_path(:format => :js), :remote => true, :id => "aPanel" do %>
<span id="navButton" class="navButton">
<span class="imageBorderOverlay"></span>
<span class="navButtonImage"><img src="/images/a.jpg"></span>
<span class="navButtonText">
<span class="navButtonTextBackground">Click Me!</span>
</span>
</span>
<% end %>
If your are using rails 2.3 remove the = sign from the erb block on the first line
精彩评论