Commit cad0981c487b1ee68bf5528c5aa5ac03606acd5d

Authored by AurelioAHeckert
1 parent 6eb1409f

ActionItem152: menu do usuário

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1266 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/helpers/application_helper.rb
... ... @@ -119,27 +119,25 @@ module ApplicationHelper
119 119 end
120 120  
121 121 def shortcut_header_links
122   - search_link = ( lightbox_link_to content_tag('span', _('Search')), { :controller => 'search', :action => 'popup' }, { :id => 'open_search'} )
123   -
124   - if logged_in?
125   - [
126   - ( link_to_homepage '<img src="' +
127   - ( (current_user.person.image)? current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png" ) +
128   - '" alt="Photo" title="" height="20" border="0"/>'+ current_user.login,
129   - current_user.login, :id=>"link_go_home" ),
130   - ( link_to_myprofile( content_tag('span', _('control panel')), {}, nil, { :id => 'link_edit_profile'} ) ),
131   - # O ID icon_accessibility tambem tem que aparcer e testei o link nao ta funcionado.
132   - ( link_to content_tag('span', _('Admin')), { :controller => 'admin_panel' }, :id => 'link_admin_panel' if current_user.person.is_admin?),
133   - ( lightbox_link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout_popup'}, :id => 'link_logout'),
134   - search_link,
135   - ]
136   - else
137   - [
138   - #( link_to _("%s's home") % @environment.name, { :controller=>"home" }, :id=>"link_to_envhome" ),
139   - ( lightbox_link_to content_tag('span', _('Login')), { :controller => 'account', :action => 'login_popup' }, :id => 'link_login' ),
140   - search_link,
141   - ]
142   - end.join(" ")
  122 +# search_link = ( lightbox_link_to content_tag('span', _('Search')), { :controller => 'search', :action => 'popup' }, { :id => 'open_search'} )
  123 +#
  124 +# if logged_in?
  125 +# [
  126 +# ( link_to_homepage '<img src="' +
  127 +# ( (current_user.person.image)? current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png" ) +
  128 +# '" alt="Photo" title="" height="20" border="0"/>'+ current_user.login,
  129 +# current_user.login, :id=>"link_go_home" ),
  130 +# ( link_to_myprofile( content_tag('span', _('control panel')), {}, nil, { :id => 'link_edit_profile'} ) ),
  131 +# ( link_to content_tag('span', _('Admin')), { :controller => 'admin_panel' }, :id => 'link_admin_panel' if current_user.person.is_admin?),
  132 +# ( lightbox_link_to content_tag('span', _('Logout')), { :controller => 'account', :action => 'logout_popup'}, :id => 'link_logout'),
  133 +# search_link,
  134 +# ]
  135 +# else
  136 +# [
  137 +# ( lightbox_link_to content_tag('span', _('Login')), { :controller => 'account', :action => 'login_popup' }, :id => 'link_login' ),
  138 +# search_link,
  139 +# ]
  140 +# end.join(" ")
143 141 end
144 142  
145 143 def link_if_permitted(link, permission = nil, target = nil)
... ...
app/helpers/assets_helper.rb
... ... @@ -2,13 +2,13 @@ module AssetsHelper
2 2  
3 3 def generate_assets_menu()
4 4 '
5   - <li><a href="#"><span class="ico-menu-blog"></span> Blogs</a></li>
6   - <li><a href="#"><span class="ico-menu-album"></span> Albuns</a></li>
7   - <li><a href="#"><span class="ico-menu-product"></span> Produtos</a></li>
8   - <li><a href="#"><span class="ico-menu-enterprise"></span> Empreendimentos</a></li>
9   - <li><a href="#"><span class="ico-menu-"></span> bli 5</a></li>
10   - <li><a href="#"><span class="ico-menu-"></span> bli 6</a></li>
11   - <li><a href="#"><span class="ico-menu-"></span> bli 7</a></li>
  5 + <li><a href="#"><span class="icon-menu-blog"></span> Blogs</a></li>
  6 + <li><a href="#"><span class="icon-menu-album"></span> Albuns</a></li>
  7 + <li><a href="#"><span class="icon-menu-product"></span> Produtos</a></li>
  8 + <li><a href="#"><span class="icon-menu-enterprise"></span> Empreendimentos</a></li>
  9 + <li><a href="#"><span class="icon-menu-community"></span> Comunidades</a></li>
  10 + <li><a href="#"><span class="icon-menu-"></span> bli 6</a></li>
  11 + <li><a href="#"><span class="icon-menu-"></span> bli 7</a></li>
12 12 '
13 13 end
14 14  
... ...
app/views/layouts/application.rhtml
... ... @@ -75,7 +75,11 @@
75 75 </script>
76 76  
77 77 <div id='user_box'>
78   - <%= shortcut_header_links %>
  78 + <%= render :file => 'layouts/user_menu' %>
  79 + <%=
  80 + lightbox_link_to '<span class="icon-menu-search"></span>'+ _('Search'),
  81 + { :controller => 'search', :action => 'popup' }, :id => 'open_search'
  82 + %>
79 83 </div><!-- id='user_box' -->
80 84  
81 85 </div><!-- id="noosfero_bar" -->
... ...
app/views/layouts/user_menu.rhtml 0 → 100644
... ... @@ -0,0 +1,36 @@
  1 +<div id="user_menu" class="top_extra_menu">
  2 +
  3 +<% if logged_in? %>
  4 + <%=
  5 + link_to_homepage '<img src="' + (
  6 + (current_user.person.image)? current_user.person.image.public_filename(:icon) : "/images/icons-bar/photo.png"
  7 + ) +
  8 + '" alt="'+ current_user.login() +' Icon-Photo" title="" height="20" border="0"/>'+
  9 + current_user.login, current_user.login, :id=>'link_go_home', :class => 'user_menu_first_link'
  10 + %>
  11 + <ul>
  12 + <li><a href="#"><span class="icon-menu-blog"></span> Meu Blog</a></li>
  13 + <%=
  14 + '<li>'+ link_to_myprofile( '<span class="icon-menu-ctrl-panel"></span>'+ _('control panel'),
  15 + {}, nil, :id => 'link_edit_profile' ) +'</li>'+
  16 + '<li>'+ lightbox_link_to( '<span class="icon-menu-logout"></span>'+ _('Logout'),
  17 + { :controller => 'account', :action => 'logout_popup'}, :id => 'link_logout' ) +'</li>'
  18 + %>
  19 + <%=
  20 + '<li>'+ link_to( '<span class="icon-menu-"></span>'+ _('Admin'),
  21 + { :controller => 'admin_panel' }, :id => 'link_admin_panel' ) +
  22 + '</li>' if current_user.person.is_admin?
  23 + %>
  24 + <li><a href="#"><span class="icon-menu-"></span><small>essa aba será 100% fechada</small></a></li>
  25 + <li><a href="#"><span class="icon-menu-"></span> soon...</a></li>
  26 + </ul>
  27 +
  28 +<% else %>
  29 +
  30 +<%= lightbox_link_to '<span class="icon-menu-login"></span>'+ _('Login'),
  31 + { :controller => 'account', :action => 'login_popup' },
  32 + :id => 'link_login', :class => 'user_menu_first_link' %>
  33 +
  34 +<% end %>
  35 +
  36 +</div><!-- fim id="user_menu" -->
... ...
app/views/shared/categories_menu.rhtml
... ... @@ -13,7 +13,7 @@
13 13 </ul><!-- fim id="cat_menu" -->
14 14  
15 15 <div id="assets_menu">
16   - <div id="assets_menu_list">
  16 + <div id="assets_menu_list" class="top_extra_menu">
17 17 <ul id="assets_menu_ul">
18 18 <%= generate_assets_menu %>
19 19 </ul>
... ...
public/designs/icons/default/community-HC.gif 0 → 100644

119 Bytes

public/designs/icons/default/edit-HC.gif 0 → 100644

135 Bytes

public/designs/icons/default/enter-HC.gif 0 → 100644

123 Bytes

public/designs/icons/default/exit-HC.gif 0 → 100644

140 Bytes

public/designs/icons/default/search-HC.gif 0 → 100644

142 Bytes

public/designs/icons/default/style.css
... ... @@ -19,8 +19,14 @@
19 19 .icon-search { background-image: url(gnome-search.png); }
20 20 .icon-ok { background-image: url(gtk-ok.png); }
21 21 .icon-login { background-image: url(key-HC.gif); }
22   -.ico-menu- { background-image: url(menu-without-ico-HC.gif) }
23   -.ico-menu-blog { background-image: url(blog-HC.gif); }
24   -.ico-menu-album { background-image: url(album-HC.gif); }
25   -.ico-menu-product { background-image: url(product-HC.gif); }
26   -.ico-menu-enterprise { background-image: url(enterprise-HC.gif); }
  22 +.icon-menu- { background-image: url(menu-without-ico-HC.gif) }
  23 +.icon-menu-blog { background-image: url(blog-HC.gif); }
  24 +.icon-menu-album { background-image: url(album-HC.gif); }
  25 +.icon-menu-product { background-image: url(product-HC.gif); }
  26 +.icon-menu-enterprise { background-image: url(enterprise-HC.gif); }
  27 +.icon-menu-community { background-image: url(community-HC.gif); }
  28 +.icon-menu-ctrl-panel { background-image: url(edit-HC.gif); }
  29 +.icon-menu-login { background-image: url(enter-HC.gif); }
  30 +.icon-menu-logout { background-image: url(exit-HC.gif); }
  31 +.icon-menu-search { background-image: url(search-HC.gif); }
  32 +
... ...
public/images/icons-bar/ico-edit.gif

135 Bytes

public/images/icons-bar/ico-enter.gif

123 Bytes

public/images/icons-bar/ico-exit.gif

140 Bytes

public/images/icons-bar/ico-search.gif

142 Bytes

public/stylesheets/menu.css
... ... @@ -63,59 +63,6 @@ body.category2 .linkSubMenu { background-image: url(/images/borda-esq-aba-verde.
63 63 body.category3 .linkSubMenu { background-image: url(/images/borda-esq-aba-lilas.gif) }
64 64 body.category4 .linkSubMenu { background-image: url(/images/borda-esq-aba-vermelho.gif) }
65 65  
66   -#user_box {
67   - position: absolute;
68   - top: 0px;
69   - right: 0px;
70   -}
71   -
72   -#user_box a:link,
73   -#user_box a:visited {
74   - font-weight: bold;
75   - text-decoration: none;
76   - line-height: 20px;
77   - color: #FFF;
78   - margin-right: 20px;
79   - padding-left: 21px;
80   - opacity: 0.7;
81   - filter: alpha(opacity=70);
82   - display: block;
83   - float: left;
84   - height: 20px;
85   - background-position: 0px 0%;
86   - background-repeat: no-repeat;
87   -}
88   -
89   -#user_box a:hover,
90   -#user_box a:active {
91   - opacity: 1;
92   - filter: alpha(opacity=100);
93   -}
94   -
95   -#user_box a#link_to_envhome {
96   - margin-right: 40px;
97   -}
98   -
99   -#user_box #link_go_home,
100   -#user_box #link_go_home:hover {
101   - position: relative;
102   - padding: 0px;
103   -}
104   -#user_box #link_go_home img {
105   - position: absolute;
106   - top: -1px;
107   - left: -23px;
108   - border: none;
109   -}
110   -.msie #link_go_home img {
111   - top: -1px;
112   -}
113   -
114   -#link_login { background-image: url(/images/icons-bar/ico-enter.gif) }
115   -#open_search { background-image: url(/images/icons-bar/ico-search.gif) }
116   -#link_edit_profile { background-image: url(/images/icons-bar/ico-edit.gif) }
117   -#link_logout { background-image: url(/images/icons-bar/ico-exit.gif) }
118   -
119 66 #cat_menu {
120 67 padding: 0px;
121 68 margin: 0px;
... ... @@ -233,17 +180,17 @@ body.category4 #assets_menu_list { background-image: url(/images/top-bar/assets-
233 180 padding: 0px;
234 181 overflow: hidden;
235 182 height: 56px;
236   - width: 170px;
237   - max-width: 165px;
  183 + width: 165px;
238 184 }
239 185  
240   -#assets_menu li {
  186 +.top_extra_menu li {
241 187 margin: 0px;
242 188 padding: 1px 0px 0px 0px;
243 189 list-style: none;
244 190 }
245 191  
246   -#assets_menu a {
  192 +#user_box a,
  193 +.top_extra_menu a {
247 194 font-size: 12px;
248 195 font-weight: bold;
249 196 text-decoration: none;
... ... @@ -252,23 +199,33 @@ body.category4 #assets_menu_list { background-image: url(/images/top-bar/assets-
252 199 padding-left: 0px;
253 200 height: 18px;
254 201 }
255   -body.category1 #assets_menu a { color: #FDD79E }
256   -body.category2 #assets_menu a { color: #C4F099 }
257   -body.category3 #assets_menu a { color: #D6BFD3 }
258   -body.category4 #assets_menu a { color: #F79494 }
259   -#assets_menu a:hover {
  202 +body.category1 #user_box a,
  203 +body.category1 .top_extra_menu a { color: #FDD79E }
  204 +body.category2 #user_box a,
  205 +body.category2 .top_extra_menu a { color: #C4F099 }
  206 +body.category3 #user_box a,
  207 +body.category3 .top_extra_menu a { color: #D6BFD3 }
  208 +body.category4 #user_box a,
  209 +body.category4 .top_extra_menu a { color: #F79494 }
  210 +#user_box a:hover,
  211 +.top_extra_menu a:hover {
260 212 background: #3465A4;
261 213 color: #FFF;
262 214 }
263   -body.category1 #assets_menu a:hover { background: #F57900; color: #FFF }
264   -body.category2 #assets_menu a:hover { background: #61B60E; color: #FFF }
265   -body.category3 #assets_menu a:hover { background: #75507B; color: #FFF }
266   -body.category4 #assets_menu a:hover { background: #CC0000; color: #FFF }
  215 +body.category1 #user_box a:hover,
  216 +body.category1 .top_extra_menu a:hover { background: #F57900; color: #FFF }
  217 +body.category2 #user_box a:hover,
  218 +body.category2 .top_extra_menu a:hover { background: #61B60E; color: #FFF }
  219 +body.category3 #user_box a:hover,
  220 +body.category3 .top_extra_menu a:hover { background: #75507B; color: #FFF }
  221 +body.category4 #user_box a:hover,
  222 +body.category4 .top_extra_menu a:hover { background: #CC0000; color: #FFF }
267 223  
268   -#assets_menu a span {
  224 +#user_box a span,
  225 +.top_extra_menu a span {
269 226 display: block;
270 227 width: 18px;
271   - height: 18px;
  228 + height: 100%;
272 229 float: left;
273 230 background-repeat: no-repeat;
274 231 background-position: 50% 50%;
... ... @@ -276,9 +233,66 @@ body.category4 #assets_menu a:hover { background: #CC0000; color: #FFF }
276 233 opacity: 0.7;
277 234 filter: alpha(opacity=70);
278 235 }
279   -#assets_menu a:hover span {
  236 +#user_box a:hover span,
  237 +.top_extra_menu a:hover span {
280 238 opacity: 1;
281 239 filter: alpha(opacity=100);
282 240 }
283 241  
  242 +/* * * User Box * * * * * * * * * * * */
  243 +
  244 +#user_box {
  245 + position: absolute;
  246 + top: 0px;
  247 + right: 0px;
  248 +}
  249 +
  250 +#open_search {
  251 + float: right;
  252 + margin-right: 10px;
  253 +}
  254 +#user_box #open_search:hover {
  255 + background: none;
  256 +}
  257 +
  258 +/* * * User Menu * * * * * * * * * * * */
  259 +
  260 +#user_menu {
  261 + position: absolute;
  262 + top: 0px;
  263 + right: 180px;
  264 + width: 130px;
  265 +}
  266 +
  267 +.user_menu_first_link {
  268 + margin-left: 4px;
  269 +}
  270 +#user_menu .user_menu_first_link:hover {
  271 + background: none;
  272 +}
  273 +
  274 +#user_menu a img {
  275 + float: left;
  276 + border: none;
  277 + margin: -1px 2px 0px 0px;
  278 + opacity: 0.7;
  279 + filter: alpha(opacity=70);
  280 +}
  281 +#user_menu a:hover img {
  282 + opacity: 1;
  283 + filter: alpha(opacity=100);
  284 +}
  285 +
  286 +#user_menu ul {
  287 + position: absolute;
  288 + top: 21px;
  289 + right: 0px;
  290 + width: 130px;
  291 + max-width: 121px;
  292 + padding: 2px 4px 5px 5px;
  293 + margin: 0px;
  294 + border: 1px solid #FFF;
  295 + border-top: none;
  296 + background: #2A5896;
  297 +}
284 298  
... ...