Thx for your hint. I'm not knowing js at all, but I found a solution:

$(document).ready(function(){
   jQuery('div.nav-bar ul').each(function(){
     jQuery(this).removeClass('web2py-menu web2py-menu-vertical');
     jQuery(this).addClass('menu');        
   });
   jQuery('li.web2py-menu-first').each(function(){
     jQuery(this).removeClass('web2py-menu-expand web2py-menu-first 
web2py-menu-last web2py-menu-active');
   });
   jQuery('li.web2py-menu-expand').each(function(){
     jQuery(this).attr({'data-role':'dropdown'});
     jQuery(this).removeClass('web2py-menu-expand web2py-menu-first 
web2py-menu-last web2py-menu-active');
   });
   jQuery('ul.menu li ul').each(function(){
     jQuery(this).removeClass('menu');
     jQuery(this).addClass('dropdown-menu');        
   });
});


This solves my problem, but isn't really elegant. It's time to write a new 
MENU helper function. 



kl. 17:06:18 UTC+1 lørdag 29. desember 2012 skrev Paolo Caruccio følgende:
>
> One possible solution (not tested).
>
> 1 step) in static/js create a new file named "web2py_metroui.js" having 
> the following contents
>
> jQuery(function(){
>   jQuery('.menu>li.dropdown').each(function(){
>       jQuery(this).attr({'class':'','data-role':'dropdown'});
>   });
>   jQuery('.menu li li').each(function(){
>     if(jQuery(this).find('ul').length)
>       jQuery(this).addClass('dropdown-submenu');
>   });
> });
>
> 2 step) in layout.html 
> a) replace existing line with (note the voice "menu")
> {{=MENU(response.menu, _class='mobile-menu nav' if is_mobile else 'nav 
> menu', mobile=is_mobile,  li_class='dropdown',  ul_class='dropdown-menu'
> )}}
>
> b) replace this line
> <script src="{{=URL('static','js/web2py_bootstrap.js')}}"></script>
> with
> <script src="{{=URL('static','js/web2py_metroui.js')}}"></script>
>
> c) remove all other refererences to bootstrap.
>
>
> Il giorno sabato 29 dicembre 2012 16:11:29 UTC+1, Sverre ha scritto:
>>
>> I'm trying to write a layout plugin with the styles of 
>> http://metroui.org.ua . A problem is, that he is using custom data in 
>> the menu definitions like 
>>  
>>
>>>             <ul class="menu">
>>>                 <li data-role="dropdown">
>>>                     <a href="#">Item 1</a>
>>>                     <ul class="dropdown-menu">
>>>                         <li><a href="#">SubItem</a></li>
>>>                         ...
>>>                         <li><a href="#">SubItem</a></li>
>>>  
>>>
>>>
>> So either I have to extend the MENU function or I have to find a another 
>> solution. Has someone a hint?
>>
>> Thx in advance
>>
>>
>>
>>  
>>
>

-- 



Reply via email to