Commit 91ecca1a7acc15f859b34164c4025ef355653ec6
1 parent
4096f649
Exists in
master
and in
29 other branches
Fix menus in old layout
(ActionItem1608)
Showing
9 changed files
with
22 additions
and
243 deletions
Show diff stats
app/views/layouts/application.rhtml
@@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
9 | <%= yield(:feeds) %> | 9 | <%= yield(:feeds) %> |
10 | 10 | ||
11 | <%= noosfero_javascript %> | 11 | <%= noosfero_javascript %> |
12 | - <%= javascript_include_tag 'menu', 'auto-open-menu', 'menu-config', :cache => 'cache-menu' %> | ||
13 | <%= theme_javascript %> | 12 | <%= theme_javascript %> |
14 | 13 | ||
15 | <%= | 14 | <%= |
@@ -88,9 +87,6 @@ | @@ -88,9 +87,6 @@ | ||
88 | <% end %> | 87 | <% end %> |
89 | <%= render :file => 'shared/assets_menu' %> | 88 | <%= render :file => 'shared/assets_menu' %> |
90 | </div><!-- id='navigation_bar' --> | 89 | </div><!-- id='navigation_bar' --> |
91 | - <script type="text/javascript"> | ||
92 | - prepareMenu('navigation_bar', { timeout: 1000 }); | ||
93 | - </script> | ||
94 | 90 | ||
95 | <div id="language-selector"> | 91 | <div id="language-selector"> |
96 | <%= language_chooser(:element => 'dropdown') %> | 92 | <%= language_chooser(:element => 'dropdown') %> |
app/views/shared/assets_menu.rhtml
@@ -7,9 +7,3 @@ | @@ -7,9 +7,3 @@ | ||
7 | </div><!-- fim id="assets_menu_list" --> | 7 | </div><!-- fim id="assets_menu_list" --> |
8 | <div id="assets_menu_layout_iten"></div> | 8 | <div id="assets_menu_layout_iten"></div> |
9 | </div><!-- fim id="assets_menu" --> | 9 | </div><!-- fim id="assets_menu" --> |
10 | - | ||
11 | -<script type="text/javascript"> | ||
12 | - if ( assetsMenu.autoOpen ) { | ||
13 | - setAutoOpenMenu( $("assets_menu") ); | ||
14 | - } | ||
15 | -</script> |
app/views/shared/user_menu.rhtml
1 | <div id="user_menu" class="top_extra_menu AOM_paddingBottom_6"> | 1 | <div id="user_menu" class="top_extra_menu AOM_paddingBottom_6"> |
2 | 2 | ||
3 | - <% if logged_in? %> | 3 | + <div id='user'> |
4 | + <div class='logged-in' style='display: none'> | ||
4 | 5 | ||
5 | <div id="user_menu_head"> | 6 | <div id="user_menu_head"> |
6 | - <img src="<%= | ||
7 | - (current_user.person.image)? | ||
8 | - current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png" | ||
9 | - %>" alt="<%= current_user.name %> Icon-Photo" title="" height="20" border="0"/> | ||
10 | - <span><%= _("%s's Menu") % current_user.person.short_name %> </span> | 7 | + <%= image_tag 'icons-app/person-icon.png', :alt => "%{login} icon photo", :height => "20", :border => "0" %> |
8 | + <span><%= _("%s's Menu") % '%{login}' %> </span> | ||
11 | </div> | 9 | </div> |
12 | 10 | ||
13 | <div id="user_menu_ul"> | 11 | <div id="user_menu_ul"> |
14 | <ul> | 12 | <ul> |
15 | 13 | ||
16 | <li> | 14 | <li> |
17 | - <%= link_to( '<span class="icon-menu-home"></span>' + __('My Home Page'), user.url)%> | 15 | + <%= link_to( '<span class="icon-menu-home"></span>' + __('My Home Page'), '/%{login}')%> |
18 | </li> | 16 | </li> |
19 | 17 | ||
20 | <li> | 18 | <li> |
21 | - <%= link_to('<span class="icon-menu-my-groups"></span>' + _('My groups'), { :controller => 'memberships', :profile => user.identifier, :action => 'index' }) %> | 19 | + <%= link_to('<span class="icon-menu-my-groups"></span>' + _('My groups'), '/myprofile/%{login}/memberships') %> |
22 | </li> | 20 | </li> |
23 | 21 | ||
24 | <li> | 22 | <li> |
25 | - <%= lightbox_link_to('<span class="icon-new"></span>' + _('New article'), user.admin_url.merge(:controller => 'cms', :action => 'new')) %> | 23 | + <%= lightbox_link_to('<span class="icon-new"></span>' + _('New article'), '/myprofile/%{login}/cms/new') %> |
26 | </li> | 24 | </li> |
27 | 25 | ||
28 | - <% for enterprise in user.enterprises %> | ||
29 | - <li><%= link_to('<span class="icon-menu-enterprise"></span>' + (_('Manage %s') % enterprise.short_name), { :controller => 'profile_editor', :profile => enterprise.identifier, :action => 'index' }) %></li> | ||
30 | - <% end %> | 26 | + <%# for enterprise in user.enterprises %> |
27 | + <li><%# link_to('<span class="icon-menu-enterprise"></span>' + (_('Manage %s') % enterprise.short_name), { :controller => 'profile_editor', :profile => enterprise.identifier, :action => 'index' }) #%></li> | ||
28 | + <%# end %> | ||
31 | 29 | ||
32 | <!-- li><a href="#"><span class="icon-menu-blog"></span> Meu Blog</a></li --> | 30 | <!-- li><a href="#"><span class="icon-menu-blog"></span> Meu Blog</a></li --> |
33 | 31 | ||
34 | - <% if MailConf.enabled? && current_user.enable_email %> | 32 | + <%# if MailConf.enabled? && current_user.enable_email %> |
35 | <li> | 33 | <li> |
36 | - <%= link_to '<span class="icon-menu-mail"></span>' + _('Webmail'), MailConf.webmail_url(user.identifier, current_user.email_domain) %> | 34 | + <%# link_to '<span class="icon-menu-mail"></span>' + _('Webmail'), MailConf.webmail_url(user.identifier, current_user.email_domain) %> |
37 | </li> | 35 | </li> |
38 | - <% end %> | 36 | + <%# end %> |
39 | 37 | ||
40 | <li> | 38 | <li> |
41 | - <%= link_to('<span class="icon-menu-ctrl-panel"></span>'+ _('Control panel'), { :controller => 'profile_editor', :action => 'index', :profile => user.identifier }, :id => 'link_edit_profile') %> | 39 | + <%= link_to('<span class="icon-menu-ctrl-panel"></span>'+ _('Control panel'), '/myprofile/%{login}', :id => 'link_edit_profile') %> |
42 | </li> | 40 | </li> |
43 | 41 | ||
44 | - <% if user.is_admin?(environment) %> | ||
45 | - <li><%= link_to( '<span class="icon-menu-admin"></span>'+ _('Admin'), | 42 | + <li class='admin-link' style='display: none'><%= link_to( '<span class="icon-menu-admin"></span>'+ _('Admin'), |
46 | {:controller => 'admin_panel' }, | 43 | {:controller => 'admin_panel' }, |
47 | :id => 'link_admin_panel' ) %> | 44 | :id => 'link_admin_panel' ) %> |
48 | </li> | 45 | </li> |
49 | - <% end %> | ||
50 | 46 | ||
51 | <li><%= link_to( '<span class="icon-menu-logout"></span>'+ _('Logout'), | 47 | <li><%= link_to( '<span class="icon-menu-logout"></span>'+ _('Logout'), |
52 | {:controller => 'account', :action => 'logout'}, | 48 | {:controller => 'account', :action => 'logout'}, |
@@ -56,7 +52,9 @@ | @@ -56,7 +52,9 @@ | ||
56 | </ul> | 52 | </ul> |
57 | </div><!-- id="user_menu_ul" --> | 53 | </div><!-- id="user_menu_ul" --> |
58 | 54 | ||
59 | - <% else %> | 55 | + </div> <!-- .logged-in --> |
56 | + | ||
57 | + <div class='not-logged-in' style='display: none'> | ||
60 | 58 | ||
61 | <% if params[:controller] != 'account' || params[:action] != 'signup' %> | 59 | <% if params[:controller] != 'account' || params[:action] != 'signup' %> |
62 | <% if theme_option( :menu_login ) == 'full_form' %> | 60 | <% if theme_option( :menu_login ) == 'full_form' %> |
@@ -69,9 +67,8 @@ | @@ -69,9 +67,8 @@ | ||
69 | <% end %> | 67 | <% end %> |
70 | <% end %> | 68 | <% end %> |
71 | 69 | ||
72 | - <% end %> | ||
73 | - | ||
74 | -</div><!-- fim id="user_menu" --> | 70 | + </div><!-- #not-logged-in --> |
75 | 71 | ||
76 | -<%= javascript_tag 'setAutoOpenMenu( $("user_menu") )' if theme_option( :menu_login ) != 'full_form' %> | 72 | + </div><!-- #user --> |
77 | 73 | ||
74 | +</div><!-- fim id="user_menu" --> |
public/images/icons-bar/photo.png
781 Bytes
public/javascripts/application.js
@@ -444,7 +444,7 @@ jQuery(function($) { | @@ -444,7 +444,7 @@ jQuery(function($) { | ||
444 | $(this).find('a[href]').each(function() { | 444 | $(this).find('a[href]').each(function() { |
445 | $(this).attr('href', $(this).attr('href').replace('%{login}', data.login)) | 445 | $(this).attr('href', $(this).attr('href').replace('%{login}', data.login)) |
446 | }); | 446 | }); |
447 | - var html = $(this).html().replace('%{login}', data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); | 447 | + var html = $(this).html().replace(/%{login}/g, data.login).replace('%{month}', data.since_month).replace('%{year}', data.since_year); |
448 | $(this).html(html).fadeIn(); | 448 | $(this).html(html).fadeIn(); |
449 | if (data.is_admin) { | 449 | if (data.is_admin) { |
450 | $('#user .admin-link').show(); | 450 | $('#user .admin-link').show(); |
public/javascripts/auto-open-menu.js
@@ -1,70 +0,0 @@ | @@ -1,70 +0,0 @@ | ||
1 | - | ||
2 | -function setAutoOpenMenu( menu ) { | ||
3 | - | ||
4 | - var mul = menu.getElementsByTagName("ul")[0]; | ||
5 | - if ( !mul ) return false; | ||
6 | - | ||
7 | - mul.h = mul.clientHeight; // remember the current height to a faster animation | ||
8 | - mul.minSize = mul.clientHeight; | ||
9 | - var vli = mul.getElementsByTagName("li"); | ||
10 | - mul.paddingBottom = parseInt( menu.className.replace( /^.*AOM_paddingBottom_([^\s]+).*$/, "$1" ) ); | ||
11 | - mul.maxSize = ( vli.length * ( vli[1].offsetTop - vli[0].offsetTop ) ); | ||
12 | - mul.inc = 1; | ||
13 | - | ||
14 | - window["autoOpenMenu-"+menu.id] = menu; | ||
15 | - menu.mul = mul; | ||
16 | - | ||
17 | - if ( mul.minSize == 1 ) { | ||
18 | - // Work arround bug for IE - ie sux - ie sux - ie sux - ie sux -ie sux -ie sux -ie sux - ie sux!!! | ||
19 | - mul.h = 3; | ||
20 | - setTimeout('m = window[\'autoOpenMenu-'+menu.id+'\']; m.onmouseout()', 10); | ||
21 | - } | ||
22 | - | ||
23 | - menu.isIE = ( navigator.appName.indexOf("Microsoft") > -1 ); | ||
24 | - | ||
25 | - menu.onmouseover = function () { | ||
26 | - clearTimeout( this.timeoutClose ); | ||
27 | - this.className = this.className.replace( / closed/g, "" ); | ||
28 | - if ( !/menu-opened/.test(this.className) ) { this.className += " opened" } | ||
29 | - var mul = this.mul; | ||
30 | - mul.style.display = "block"; | ||
31 | - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = mul.paddingBottom +"px"; | ||
32 | - if ( mul.h < mul.maxSize ) { | ||
33 | - mul.h += mul.inc; | ||
34 | - mul.inc += 2; | ||
35 | - mul.style.height = mul.h +"px"; | ||
36 | - this.timeoutOpen = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseover()", 33 ); | ||
37 | - } else { | ||
38 | - mul.h = mul.maxSize; | ||
39 | - mul.style.height = mul.h +"px"; | ||
40 | - mul.inc = 1; | ||
41 | - } | ||
42 | - } | ||
43 | - | ||
44 | - menu.onmouseout = function ( doIt, firstDoIt ) { | ||
45 | - clearTimeout( this.timeoutOpen ); | ||
46 | - var mul = this.mul; | ||
47 | - if ( firstDoIt ) mul.inc = 1; | ||
48 | - if ( doIt == true ) { | ||
49 | - if ( mul.h > mul.minSize ) { | ||
50 | - mul.h -= mul.inc++; | ||
51 | - if ( mul.h < 0 ) mul.h = 0; | ||
52 | - if ( mul.h == 0 ) mul.style.display = "none"; | ||
53 | - if ( this.isIE ) if ( mul.h < 1 ) mul.h = 1; | ||
54 | - mul.style.height = mul.h +"px"; | ||
55 | - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true)", 33 ); | ||
56 | - } else { | ||
57 | - mul.h = mul.minSize; | ||
58 | - mul.style.height = mul.h +"px"; | ||
59 | - if ( mul.paddingBottom ) mul.parentNode.style.paddingBottom = "0px"; | ||
60 | - mul.inc = 2; | ||
61 | - this.className = this.className.replace( / opened/g, "" ); | ||
62 | - this.className += " closed" | ||
63 | - } | ||
64 | - } else { | ||
65 | - // Work arround IE bug | ||
66 | - this.timeoutClose = setTimeout( "window['autoOpenMenu-"+this.id+"'].onmouseout(true, true)", 200 ); | ||
67 | - } | ||
68 | - } | ||
69 | - | ||
70 | -} |
public/javascripts/menu-config.js
public/javascripts/menu.js
@@ -1,129 +0,0 @@ | @@ -1,129 +0,0 @@ | ||
1 | -function prepareMenu(id, options) { | ||
2 | - | ||
3 | - window.menuCloseTimeout = options.timeout || 333; | ||
4 | - | ||
5 | - if ( document.all ) { | ||
6 | - // add a class for work arround msie's css bugs | ||
7 | - $(id).className += " msie"; | ||
8 | - } | ||
9 | - $(id).className += " menuRoot"; | ||
10 | - | ||
11 | - var zIndex = 10; | ||
12 | - | ||
13 | - $$("#" + id + " ul ul").each( function( ul ) { // para cada UL de sub-menu faça: | ||
14 | - // Pega o link que abre este sub-menu: | ||
15 | - var linkText = ul.parentNode.firstChild; | ||
16 | - // Retira espaço em branco sobrando nas bordas deste: | ||
17 | - linkText.nodeValue = linkText.nodeValue.replace( /^\s*|\s*$/g, "" ); | ||
18 | - | ||
19 | - // Create a link to open this sub-menu: | ||
20 | - var link = document.createElement("a"); | ||
21 | - link.href = "#"; | ||
22 | - link.className = "linkSubMenu"; | ||
23 | - linkText.parentNode.insertBefore( link, linkText ); | ||
24 | - link.parentNode.style.zIndex = zIndex++; | ||
25 | - link.subMenu = ul; | ||
26 | - var span = document.createElement("span"); | ||
27 | - span.appendChild( linkText ); | ||
28 | - link.appendChild( span ); | ||
29 | - ul.linkControle = link; | ||
30 | - link.openSubMenu = | ||
31 | - function ( isMouseClick ) { | ||
32 | - if( this.subMenu.style.display == "block" ) { | ||
33 | - if( isMouseClick ) { | ||
34 | - this.subMenu.style.display = "none"; | ||
35 | - } else { | ||
36 | - clearTimeout(this.timeOutClose); | ||
37 | - clearTimeout(this.subMenu.timeOutClose); | ||
38 | - return false; | ||
39 | - } | ||
40 | - } else { | ||
41 | - if ( window.openedMenu ) window.openedMenu.closeSubMenu(); | ||
42 | - window.openedMenu = this.subMenu; | ||
43 | - this.className += " menu-opened" | ||
44 | - this.subMenu.style.display = "block"; | ||
45 | - clearTimeout(this.timeOutClose); | ||
46 | - clearTimeout(this.subMenu.timeOutClose); | ||
47 | - } | ||
48 | - } | ||
49 | - link.closeSubMenu = | ||
50 | - function(){ | ||
51 | - this.subMenu.style.display = "none"; | ||
52 | - //link.className = link.className.replace( / menu-opened/g, "" ); | ||
53 | - this.className = this.className.replace( / menu-opened/g, "" ); | ||
54 | - } | ||
55 | - | ||
56 | - //link.onclick = function(){ this.openSubMenu(true); return false }Is not working | ||
57 | - | ||
58 | - // onmouseout e onmouseover manipulam o menu para pessoas normais | ||
59 | - // onblur e onfocus manipulam o menu para pessoas que precisam navegar com tab | ||
60 | - | ||
61 | - link.onmouseover = link.onfocus = | ||
62 | - function () { | ||
63 | - this.openSubMenu(false); | ||
64 | - }; | ||
65 | - link.onmouseout = link.onblur = | ||
66 | - function () { | ||
67 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | ||
68 | - }; | ||
69 | - | ||
70 | - //ul.closeSubMenu = function(){ this.style.display = "none" } | ||
71 | - ul.closeSubMenu = function(){ this.linkControle.closeSubMenu() } | ||
72 | - | ||
73 | - ul.onmouseover = ul.onfocus = | ||
74 | - function () { | ||
75 | - this.blurCalledByIEWorkArroundBug = false; | ||
76 | - clearTimeout(this.timeOutClose); | ||
77 | - clearTimeout(this.linkControle.timeOutClose); | ||
78 | - }; | ||
79 | - ul.onmouseout = ul.onblur = | ||
80 | - function () { | ||
81 | - if ( this.blurCalledByIEWorkArroundBug ) { return false } | ||
82 | - this.blurCalledByIEWorkArroundBug = true; | ||
83 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | ||
84 | - }; | ||
85 | - }); | ||
86 | - | ||
87 | - | ||
88 | - // **** begin of workaround for Microsoft Internet Explorer **** | ||
89 | - // MS IE sucks, BTW. | ||
90 | - if ( document.all ) { | ||
91 | - function forceUlFocusFromLink ( a ) { | ||
92 | - /*var stop = false; | ||
93 | - a.ancestors().each( function(el) { | ||
94 | - if ( el.id == "menu" ) { stop = true } | ||
95 | - if ( ! stop && el.onfocus ) { el.onfocus() } | ||
96 | - } );*/ | ||
97 | - var el = a.parentNode; | ||
98 | - while ( / menuRoot/.test(el.className) ) el = el.parentNode; | ||
99 | - if ( el.onfocus ) { el.onfocus() } | ||
100 | - } | ||
101 | - function forceUlBlurFromLink ( a ) { | ||
102 | - /*var stop = false; | ||
103 | - a.ancestors().each( function(el) { | ||
104 | - if ( el.id == "menu" ) { stop = true } | ||
105 | - if ( ! stop && el.onblur ) { el.onblur() } | ||
106 | - } );*/ | ||
107 | - var el = a.parentNode; | ||
108 | - while ( / menuRoot/.test(el.className) ) el = el.parentNode; | ||
109 | - if ( el.onblur ) { el.onblur() } | ||
110 | - } | ||
111 | - $$("#" + id + " ul ul a").each( function( a ) { | ||
112 | - // os links do sub menu forçarão o foco do ul | ||
113 | - if ( a.className == "linkSubMenu" ) { | ||
114 | - a.onfocus = function() { | ||
115 | - forceUlFocusFromLink(this); | ||
116 | - this.openSubMenu(false); | ||
117 | - }; | ||
118 | - a.onblur = function() { | ||
119 | - forceUlBlurFromLink(this); | ||
120 | - this.timeOutClose = setTimeout( this.closeSubMenu.bind(this), window.menuCloseTimeout ); | ||
121 | - }; | ||
122 | - } else { | ||
123 | - a.onfocus = function() { forceUlFocusFromLink(this) }; | ||
124 | - a.onblur = function() { forceUlBlurFromLink(this) }; | ||
125 | - } | ||
126 | - }); | ||
127 | - } // ** end of workaround for Microsoft Internet Explorer. | ||
128 | - | ||
129 | -} |
public/stylesheets/application.css
@@ -907,7 +907,6 @@ code input { | @@ -907,7 +907,6 @@ code input { | ||
907 | 907 | ||
908 | #user_menu { | 908 | #user_menu { |
909 | border: none; /* work arround IE Bug */ | 909 | border: none; /* work arround IE Bug */ |
910 | - background: transparent; /* work arround IE Bug */ | ||
911 | } | 910 | } |
912 | 911 | ||
913 | #user_menu_head { | 912 | #user_menu_head { |
@@ -928,7 +927,6 @@ code input { | @@ -928,7 +927,6 @@ code input { | ||
928 | margin-left: 4px; | 927 | margin-left: 4px; |
929 | } | 928 | } |
930 | #user_menu a#link_login:hover { | 929 | #user_menu a#link_login:hover { |
931 | - background: none; | ||
932 | } | 930 | } |
933 | 931 | ||
934 | #user_box a#link_go_home { | 932 | #user_box a#link_go_home { |