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

View File

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

View File

@ -21,26 +21,38 @@ module ApplicationHelper
end
# Clean the link back
# Remove the locale but keep all the other params
def get_go_back
begin
if request.url.include?('locale=')
session[:last_page]
else
target = request.referer.split('?')
vars = target[1].split('&') rescue []
vars.delete_if {|var| var.include? 'locale=' }
session[:last_page] = if vars.size > 0
target[0].to_s + '?' + vars.join('&')
else
target[0].to_s
end
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.delete_if {|var| var.include? 'locale=' }
if vars.size > 0
target[0].to_s + '?' + vars.join('&')
else
target[0].to_s
end
end
def add_locale(url, locale)
if url.include?('?')
url + "&locale=#{locale}"
else
url + "?locale=#{locale}"
end
end
def message_for_item(message, item = nil)
if item.is_a?(Array)
message % link_to(*item)

View File

@ -17,6 +17,14 @@
<li><%= link_to t(:homepage), root_path, :class => 'orbit-bar-home' %></li>
</ul>
<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? %>
<li class="dropdown active clear">
<a class="orbit-bar-account" href="#" data-toggle="dropdown">
@ -25,11 +33,16 @@
<span class="member-name"><%= current_user.name %></span>
</a>
<ul class="dropdown-menu account-menu">
<li><a class="orbit-bar-desktop" href="#">Desktop</a></li>
<li>
<a href="#">
<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>
</li>
<li><%= link_to content_tag(:i, nil, :class => 'icons-out') + t(:logout), destroy_user_session_path %></li>
@ -38,14 +51,14 @@
<li>
<a href="#">
<i class="icons-help"></i>
Help
<%= t(:help) %>
</a>
</li>
</ul>
</li>
<% else %>
<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">
<ul class="log">
<li class="title"></li>