Change orbit-bar for language but bug when user name is too long

This commit is contained in:
Christophe Vilayphiou 2012-02-29 04:21:56 +08:00
parent 18617850e5
commit 9aa4173933
7 changed files with 89 additions and 40 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -1,10 +1,10 @@
@font-face{ @font-face{
font-family: 'WebSymbolsRegular'; font-family: 'WebSymbolsRegular';
src: url(<%= asset_path 'websymbols-regular-webfont.eot' %>); src: url(<%= asset_path 'fonts/websymbols-regular-webfont.eot' %>);
src: url(<%= asset_path 'websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'), src: url(<%= asset_path 'fonts/websymbols-regular-webfont.eot?#iefix' %>) format('embedded-opentype'),
url(<%= asset_path 'websymbols-regular-webfont.woff' %>) format('woff'), url(<%= asset_path 'fonts/websymbols-regular-webfont.woff' %>) format('woff'),
url(<%= asset_path 'websymbols-regular-webfont.ttf' %>) format('truetype'), url(<%= asset_path 'fonts/websymbols-regular-webfont.ttf' %>) format('truetype'),
url(<%= asset_path 'websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg'); url(<%= asset_path 'fonts/websymbols-regular-webfont.svg#WebSymbolsRegular' %>) format('svg');
} }
.login-logo { .login-logo {
text-indent: -9999px; text-indent: -9999px;
@ -21,7 +21,7 @@
left: 0; left: 0;
} }
#orbit-bar .navbar-inner { #orbit-bar .navbar-inner {
height: 40px; height: 28px;
-moz-border-radius: 0px; -moz-border-radius: 0px;
-webkit-border-radius: 0px; -webkit-border-radius: 0px;
border-radius: 0px; border-radius: 0px;
@ -40,7 +40,7 @@
} }
#orbit-bar .navbar-search { #orbit-bar .navbar-search {
float: none; float: none;
margin: 6px auto 0; margin: 0 auto;
text-align: center; text-align: center;
} }
#orbit-bar .nav.pull-right { #orbit-bar .nav.pull-right {
@ -50,23 +50,24 @@
background-image: url(<%= asset_path 'main-search.png' %>); background-image: url(<%= asset_path 'main-search.png' %>);
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: 5px 6px; background-position: 5px 6px;
background-color: rgba(255, 255, 255, 0.8);
color: #333;
padding-left: 25px; padding-left: 25px;
text-shadow: 0px 1px 0px #FFF; /*background-color: rgba(255, 255, 255, 0.8);
color: #333;
text-shadow: 0px 1px 0px #FFF;*/
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15); box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3) inset, 0 1px 0 rgba(255, 255, 255, 0.15);
} }
#orbit-bar .search-query:focus { #orbit-bar .search-query:focus {
background-color: rgba(255, 255, 255, 0.9); /*background-color: rgba(255, 255, 255, 0.9);
text-shadow: 0px 1px 0px #FFF; text-shadow: 0px 1px 0px #FFF;*/
background-position: 6px 7px; background-position: 6px 7px;
} }
#orbit-bar .container { #orbit-bar .container {
width:100%; width:100%;
} }
#orbit-bar .orbit-logo .brand { #orbit-bar .orbit-logo .brand {
background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px top; background: url(<%= asset_path 'orbit-bar.png' %>) no-repeat -162px -5px;
text-indent:-9999px; text-indent:-9999px;
padding: 5px 20px 4px;
} }
#orbit-bar .orbit-logo .brand:hover { #orbit-bar .orbit-logo .brand:hover {
background-color: rgba(0,157,220,1); background-color: rgba(0,157,220,1);
@ -87,10 +88,10 @@
width: 16px; width: 16px;
height: 16px; height: 16px;
text-indent: -9999px; text-indent: -9999px;
padding:12px; padding:6px;
} }
#orbit-bar .nav > li > a.orbit-bar-home { #orbit-bar .nav > li > a.orbit-bar-home {
background-position: -4px -4px; background-position: -10px -10px;
} }
#orbit-bar .nav > li > a.orbit-bar-desktop { #orbit-bar .nav > li > a.orbit-bar-desktop {
background-position: -100px -4px; background-position: -100px -4px;
@ -98,28 +99,36 @@
#orbit-bar .nav > li > a.orbit-bar-member { #orbit-bar .nav > li > a.orbit-bar-member {
background-position: -4px -37px; background-position: -4px -37px;
} }
#orbit-bar .nav > li > a.orbit-bar-search { #orbit-bar .nav > li > a.orbit-bar-member {
background-position: -68px -4px; background-position: -10px -43px;
}
#orbit-bar .nav > li > a.orbit-bar-language {
background-position: -42px -42px;
}
.language-menu .active {
color: #ffffff;
text-decoration: none;
background-color: #0088cc;
} }
#orbit-bar .nav > li > a.orbit-bar-account { #orbit-bar .nav > li > a.orbit-bar-account {
background-image: none; background-image: none;
height: 34px; height: 22px;
padding: 3px; padding: 3px;
text-indent: inherit; text-indent: inherit;
min-width: 125px; min-width: 110px;
width: auto !important; width: auto !important;
text-align: left; text-align: left;
} }
#orbit-bar .nav span.member-name { #orbit-bar .nav span.member-name {
display: inline-block; display: inline-block;
float: right; float: right;
line-height: 34px; line-height: 22px;
padding: 0 10px; padding: 0 10px;
} }
#orbit-bar .nav img.member-img { #orbit-bar .nav img.member-img {
display: inline-block; display: inline-block;
float: left; float: left;
max-width: 34px; max-width: 22px;
} }
#orbit-bar .account-menu { #orbit-bar .account-menu {
right: 5px; right: 5px;
@ -251,6 +260,7 @@
text-align: center; text-align: center;
padding: 17px 20px 0; padding: 17px 20px 0;
margin: 0; margin: 0;
border-top: none;
} }
#main-wrap .subnav { #main-wrap .subnav {
height: auto; height: auto;
@ -260,7 +270,11 @@
margin: 18px 0 0; margin: 18px 0 0;
text-align: center; text-align: center;
} }
#main-wrap .breadcrumb { .main-list .route-group td {
border: none;
}
#main-wrap .route-group .breadcrumb {
background-image: none;
border-radius: 0; border-radius: 0;
-moz-border-radius: 0; -moz-border-radius: 0;
-webkit-border-radius: 0; -webkit-border-radius: 0;
@ -269,6 +283,7 @@
-webkit-box-shadow: none; -webkit-box-shadow: none;
-moz-box-shadow: none; -moz-box-shadow: none;
margin-bottom: 0px; margin-bottom: 0px;
padding: 7px 8px 5px;
} }
#main-wrap .breadcrumb li { #main-wrap .breadcrumb li {
font-size: 12px; font-size: 12px;
@ -369,6 +384,9 @@
-moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); -moz-box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.2);
} }
.filters > div {
background-color: #dadada;
}
.filters .btn { .filters .btn {
margin-bottom: 5px; margin-bottom: 5px;
} }
@ -386,7 +404,7 @@
box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5); box-shadow: inset 0 1px 0px rgba(255, 255, 255, 0.5);
} }
.filters .in { .filters .in {
border-bottom: 1px solid rgba(0,0,0,0.07) /*border-bottom: 1px solid rgba(0,0,0,0.07)*/
} }
.sign-in { .sign-in {
width: 360px; width: 360px;
@ -648,6 +666,9 @@
.icons-out { .icons-out {
background-position: -416px -96px; background-position: -416px -96px;
} }
.icons-desktop {
background-position: -448px -96px;
}
/*5*/ /*5*/
.icons-page-blank { .icons-page-blank {
background-position: 0px -128px; background-position: 0px -128px;
@ -662,6 +683,9 @@
background-position: -0px -128px; background-position: -0px -128px;
} }
/*6*/ /*6*/
.icons-globe {
background-position: -96px -160px;
}
.icons-structure { .icons-structure {
background-position: -352px -160px; background-position: -352px -160px;
} }

View File

@ -38,7 +38,7 @@ class PagesController < ApplicationController
end end
def load_orbit_bar def load_orbit_bar
render :partial => 'layouts/orbit_bar' render :partial => 'layouts/orbit_bar', :locals => {:referer => request.referer}
end end
protected protected

View File

@ -21,23 +21,35 @@ module ApplicationHelper
end end
# Clean the link back # Clean the link back
# Remove the locale but keep all the other params
def get_go_back def get_go_back
begin begin
if request.url.include?('locale=') if request.url.include?('locale=')
session[:last_page] session[:last_page]
else else
target = request.referer.split('?') session[:last_page] = remove_locale(request.referer)
end
rescue
eval(params[:controller].split('/').join('_') << '_url')
end
end
# Remove the locale but keep all the other params
def remove_locale(url)
target = url.split('?')
vars = target[1].split('&') rescue [] vars = target[1].split('&') rescue []
vars.delete_if {|var| var.include? 'locale=' } vars.delete_if {|var| var.include? 'locale=' }
session[:last_page] = if vars.size > 0 if vars.size > 0
target[0].to_s + '?' + vars.join('&') target[0].to_s + '?' + vars.join('&')
else else
target[0].to_s target[0].to_s
end end
end end
rescue
eval(params[:controller].split('/').join('_') << '_url') def add_locale(url, locale)
if url.include?('?')
url + "&locale=#{locale}"
else
url + "?locale=#{locale}"
end end
end end

View File

@ -17,6 +17,14 @@
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li> <li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
</ul> </ul>
<ul class="nav pull-right"> <ul class="nav pull-right">
<li class="dropdown language">
<a class="dropdown-toggle orbit-bar-language" href="#" data-toggle="dropdown">language</a>
<ul class="dropdown-menu language-menu">
<% @site_in_use_locales.each do |locale| %>
<%= content_tag :li, (link_to t(:_locale, :locale => locale), add_locale(remove_locale(referer), locale)), :class => (I18n.locale.eql?(locale.to_sym) ? 'active' : nil) %>
<% end %>
</ul>
</li>
<% if user_signed_in? %> <% if user_signed_in? %>
<li class="dropdown active clear"> <li class="dropdown active clear">
<a class="orbit-bar-account" href="#" data-toggle="dropdown"> <a class="orbit-bar-account" href="#" data-toggle="dropdown">
@ -25,11 +33,16 @@
<span class="member-name"><%= current_user.name %></span> <span class="member-name"><%= current_user.name %></span>
</a> </a>
<ul class="dropdown-menu account-menu"> <ul class="dropdown-menu account-menu">
<li><a class="orbit-bar-desktop" href="#">Desktop</a></li>
<li> <li>
<a href="#"> <a href="#">
<i class="icons-wrench"></i> <i class="icons-wrench"></i>
Account settings <%= t(:account_settings) %>
</a>
</li>
<li>
<a class="orbit-bar-desktop" href="#">
<i class="icons-desktop"></i>
<%= t(:desktop) %>
</a> </a>
</li> </li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-out') + t(:logout), destroy_user_session_path %></li> <li><%= link_to content_tag(:i, nil, :class => 'icons-out') + t(:logout), destroy_user_session_path %></li>
@ -38,14 +51,14 @@
<li> <li>
<a href="#"> <a href="#">
<i class="icons-help"></i> <i class="icons-help"></i>
Help <%= t(:help) %>
</a> </a>
</li> </li>
</ul> </ul>
</li> </li>
<% else %> <% else %>
<li class="dropdown bar-login"> <li class="dropdown bar-login">
<a class="brand dropdown-toggle orbit-bar-member" href="#"><%= t(:login) %></a> <a class="dropdown-toggle orbit-bar-member" href="#"><%= t(:login) %></a>
<div class="dropdown-menu"> <div class="dropdown-menu">
<ul class="log"> <ul class="log">
<li class="title"></li> <li class="title"></li>