Submenu (start)
This commit is contained in:
parent
c47622688b
commit
13c2164bbd
2 changed files with 16 additions and 8 deletions
|
|
@ -27,12 +27,15 @@
|
|||
<li><a<%= menu_active_if("projects")%> href="/projects/">Projekte</a>
|
||||
<li><a<%= menu_active_if("members")%> href="/members/">Members</a>
|
||||
<li><a<%= menu_active_if("planet-cccs")%> href="/planet-cccs/">Planet CCCS</a>
|
||||
<li><a<%= menu_active_if("archive")%> href="#">Archiv</a>
|
||||
<li><a<%= menu_active_if("archives")%> href="/archives/articles/">Archiv</a>
|
||||
</ul>
|
||||
<% if (path_section(item,1)=="archives") %>
|
||||
<ul class="nav span11">
|
||||
<li><a href="#">Aktuell</a>
|
||||
<li><a href="#">Vergangenes</a>
|
||||
<li><a<%= menu_active_if("articles",2)%> href="/archives/articles/">Artikel</a>
|
||||
<li><a<%= menu_active_if("twitter",2)%> href="/archives/twitter/">Twitter</a>
|
||||
<li><a<%= menu_active_if("oldsite",2)%> href="/archives/oldsite/">Alte Webseite</a>
|
||||
</ul>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
|
||||
|
|
|
|||
15
lib/menu.rb
15
lib/menu.rb
|
|
@ -1,13 +1,18 @@
|
|||
def path_section(item)
|
||||
if (item.path=='/') then
|
||||
def path_section(item, n=1)
|
||||
if (n==1 && item.path=='/') then
|
||||
'main'
|
||||
else
|
||||
item.identifier.split('/')[1]
|
||||
sections = item.identifier.split('/')
|
||||
if (n<sections.size)
|
||||
sections[n]
|
||||
else
|
||||
''
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def menu_active_if(ident, cssclasses='')
|
||||
if (ident==path_section(item)) then
|
||||
def menu_active_if(ident, n=1, cssclasses='')
|
||||
if (ident==path_section(item, n)) then
|
||||
" class=\"active #{cssclasses}\""
|
||||
else
|
||||
" class=\"#{cssclasses}\""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue