Mark active path in menu

This commit is contained in:
Stefan Schlott 2013-08-23 20:10:36 +02:00
parent 27f48271e2
commit c47622688b
2 changed files with 22 additions and 7 deletions

15
lib/menu.rb Normal file
View file

@ -0,0 +1,15 @@
def path_section(item)
if (item.path=='/') then
'main'
else
item.identifier.split('/')[1]
end
end
def menu_active_if(ident, cssclasses='')
if (ident==path_section(item)) then
" class=\"active #{cssclasses}\""
else
" class=\"#{cssclasses}\""
end
end