Submenu (start)
This commit is contained in:
parent
c47622688b
commit
13c2164bbd
2 changed files with 16 additions and 8 deletions
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