Add support for multilevel dropdown menus

Due to multilevel menus has been dropped in Bootstrap 3, some code
changes are neccessary to get this function back.