for example 3 is in active state. right now all i can think of is in
each action, just set a variable like @active = ‘active’ or ‘’, but not
sure what to do with the span.
<ul>
<!-- The link you call "active" will show up as a darker tab -->
<li><a href="index.html">1</a></li>
<li><a href="index.html">2</a></li>
<li class="active"> <span>3</span> </li>
<li><a href="index.html">4</a></li>
<li><a href="index.html">5</a></li>
</ul>
On Jun 1, 2007, at 10:55 AM, mixplate wrote:
<li><a href="index.html">4</a></li>
<li><a href="index.html">5</a></li>
</ul>
–
Assuming that the “index.html” would actually be based on the 1, 2,
etc.:
<% for example in @examples %>
- <%= link_to_unless_current example, example_path(example) do |text|
content_tag(:span, text, :class => 'active')
end %>
<% end %>
When @examples = [1,2,3,4,5]
and example_path(3) => “/example/3”
Gives:
Is that what you’re looking for? The link_to_if, link_to_unless,
link_to_unless_current helpers take a block that is passed the text
of the link when the condition isn’t satisfied for making the link.
-Rob
Rob B. http://agileconsultingllc.com
[email protected]
(resending without being signed, sorry if the original shows up)
On Jun 1, 2007, at 10:55 AM, mixplate wrote:
<li><a href="index.html">4</a></li>
<li><a href="index.html">5</a></li>
</ul>
–
Assuming that the “index.html” would actually be based on the 1, 2,
etc.:
<% for example in @examples %>
- <%= link_to_unless_current example, example_path(example) do |text|
content_tag(:span, text, :class => 'active')
end %>
<% end %>
When @examples = [1,2,3,4,5]
and example_path(3) => “/example/3”
Gives:
Is that what you’re looking for? The link_to_if, link_to_unless,
link_to_unless_current helpers take a block that is passed the text
of the link when the condition isn’t satisfied for making the link.
-Rob
Rob B. http://agileconsultingllc.com
[email protected]
I Rob,Thank you for your reply. Actually, the code i pasted would be
more like this:
<ul>
<!-- The link you call "active" will show up as a darker tab -->
<li> <% link_to :action => get_category, :category => 'pork' %>
3
<% link_to :action => get_category, :category => 'beef'
%>
</ul>
so @examples would be an array of my category names?
Rob B. wrote:
(resending without being signed, sorry if the original shows up)
On Jun 1, 2007, at 10:55 AM, mixplate wrote:
<li><a href="index.html">4</a></li>
<li><a href="index.html">5</a></li>
</ul>
–
Assuming that the “index.html” would actually be based on the 1, 2,
etc.:
<% for example in @examples %>
- <%= link_to_unless_current example, example_path(example) do |text|
content_tag(:span, text, :class => 'active')
end %>
<% end %>
When @examples = [1,2,3,4,5]
and example_path(3) => “/example/3”
Gives:
Is that what you’re looking for? The link_to_if, link_to_unless,
link_to_unless_current helpers take a block that is passed the text
of the link when the condition isn’t satisfied for making the link.
-Rob
Rob B. http://agileconsultingllc.com
[email protected]
Well, if you need to have
...
rather than
1
-Rob
Rob B. http://agileconsultingllc.com
[email protected]
–
Posted via http://www.ruby-forum.com/.
Rob B. http://agileconsultingllc.com
[email protected]
+1 513-295-4739
Skype: rob.biedenharn