I''ve come up with a very hackish way of creating a tri-state image
navbar. I don''t like it but it works pretty well. I would love to
know
the ''rails'' way of doing this or even just a suggestion.
Here''s my
helper.
module ApplicationHelper
# we use this function to create the tri-state image with rollovers
# todo I need to use a good css trick for this and not this function
def navigation_bar
links = [ ''home|/store/home'',
''about|/store/about'',
''necklaces|/store/browse/necklaces'',
''bracelets|/store/browse/bracelets'',
''earrings|/store/browse/earrings'',
''archives|/store/archives'',
''journal|/journal'',
''customer|/store/customer'',
''cart|/store/display_cart'']
navbar = String.new
links.each do |link|
image,action = link.split(''|'')
if(@current_page.to_s == image)
navbar << %Q{<img id="#{image}"
src="/images/#{image}2.gif">}
else
navbar << %Q{<a href="#{action}"><img
id="#{image}"
src="/images/#{image}.gif"
onMouseOver="this.src=''/images/#{image}2.gif''"
onMouseOut="this.src=''/images/#{image}.gif''"></a>}
end
end
navbar
end
end
charlie bowman
recentrambles.com
--
Posted via http://www.ruby-forum.com/.