Hallo,
On 8/31/07, Sebastian Wenzlaff <[EMAIL PROTECTED]> wrote:
> Also bleiben 2 Fragen:
> 1) Wie macht ihr das mit euren Menüs? Ihr werdet doch kaum alle
> Einträge per HTML ins Layout schieben, oder?
Bei CueSpace mache ich es wie das Blog-CMS Typo. Schau Dir dessen Code
an. Im Application-Helper habe ich sowas:
def tab(label, options = {})
if controller.controller_name =~ /#{options[:controller].split('/').last}/
content_tag(:li, link_to(label, options), {"class"=> "selected"})
else
content_tag(:li, link_to(label, options))
end
end
Das Navigation-Partial sieht etwa so aus:
<ul>
<%= tab "Home".t, :controller => 'home', :action => 'index' -%>
<%= tab "Search".t, :controller => 'search', :action => 'index' -%>
...
</ul>
Dazu etwas CSS, hier ein Ausriss:
#navigation a {
background: transparent
url("../images/stylesheet/bg_navigation.gif") repeat-x 0 0;
border-right: 1px solid #081828;
color: #fff;
height: 29px;
line-height: 29px;
padding: 0 1em;
}
#navigation a:hover,
#navigation .selected a {
background-position: 0 -50px;
}
Und schon ist man mit der Navigation durch. Funktioniert und ist
ziemlich simpel.
Andreas Roedl
_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug