From 4830a9a7b882e114edc2e79a45c3f4e8226cd207 Mon Sep 17 00:00:00 2001 From: manson Date: Sun, 25 May 2014 20:47:44 +0800 Subject: [PATCH] Orbit bar search done, fix site language seting for new checkbox js, fix orbit-boostrap template memu, translations --- .../stylesheets/lib/orbit_bar/orbit-bar.scss | 454 ++++++++++++++++++ app/controllers/admin/sites_controller.rb | 6 +- .../assets/stylesheets/unit/_main-menu.scss | 16 +- app/views/admin/sites/preference.html.erb | 2 +- app/views/orbit_bar/index.html.erb | 21 +- app/views/sessions/new.html.erb | 2 +- config/locales/zh_tw.yml | 9 + 7 files changed, 496 insertions(+), 14 deletions(-) diff --git a/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss b/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss index b8523a0..b7cc557 100644 --- a/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss +++ b/app/assets/stylesheets/lib/orbit_bar/orbit-bar.scss @@ -353,6 +353,460 @@ body { } } +@media (max-width: 479px) { + #orbit-bar { + .login-window { + width: 90%; + margin-left: -45%; + .login-body { + form { + width: 100%; + } + .input-prepend { + .input-xlarge { + width: 80%; + } + } + } + } + .orbit-bar-inner { + & > label { + display: block; + } + & > ul { + background-color: $orbit-bar-bgc-darker; + & > li { + display: block; + float: none; + &:hover { + padding-bottom: 0; + } + & > ul { + display: block; + position: static; + margin: 0; + padding: 0; + background-color: transparent; + list-style: none; + border-radius: none; + border: none; + box-shadow: none; + &:before { + display: none; + } + li { + &.divider { + background-color: $orbit-bar-bgc; + margin: 0; + } + } + } + } + } + } + ul.orbit-bar-menu { + display: none; + float: none; + .orbit-bar-logo, .orbit-bar-home { + display: none; + } + } + .orbit-bar-title { + display: block; + } + ul.orbit-bar-search-sign-language { + display: none; + float: none; + & > li { + background-color: $orbit-bar-bgc-dark; + text-align: center; + #search { + text-align: center; + input[type="search"] { + width: 80%; + } + } + & + li { + width: 50%; + float: left; + border-top: 1px solid $orbit-bar-bgc-light; + box-shadow: inset -1px 0 0 $orbit-bar-bgc-light; + & + li { + box-shadow: none; + } + &:hover { + & > a, & > span { + background-color: $orbit-bar-bgc; + } + & > ul { + position: absolute; + width: 100%; + background-color: $orbit-bar-bgc-dark; + border-radius: 0; + } + } + } + & > ul { + display: none; + } + } + } + } +}@import "http://fonts.googleapis.com/css?family=Chivo"; +$orbit-bar-bgc: #333 !default; +$orbit-bar-bgc-darker: darken($orbit-bar-bgc, 20%) !default; +$orbit-bar-bgc-dark: darken($orbit-bar-bgc, 10%) !default; +$orbit-bar-bgc-light: lighten($orbit-bar-bgc, 10%) !default; +$orbit-bar-bgc-lighter: lighten($orbit-bar-bgc, 20%) !default; + +@mixin clearfix() { + &:before, + &:after { + content: " "; // 1 + display: table; // 2 + } + &:after { + clear: both; + } +} + +.orbitMenuLink { + cursor: pointer; + width: 50px; + height: 40px; + padding: 0 0.5em; + background-size: 70%; + display: block; + line-height: 40px; + color: #FFF; + font-family: 'Chivo'; + i { + display: block; + width: 50px; + height: 40px; + line-height: 40px; + font-size: 1.4em; + @media (max-width: 479px) { + width: 100%; + text-align: center; + } + } +} +body { + background-color: #ededed; +} +#orbit-bar { + position: fixed; + top: 0; + right: 0; + left: 0; + z-index: 999; + font-family: 'Chivo'; + #open-orbit-nav, + #open-orbit-login { + position: absolute; + visibility: hidden; + top: 0; + left: -100px; + } + #open-orbit-nav { + &:checked { + & + .orbit-bar-inner { + @media (max-width: 479px) {height: auto;} + .orbit-bar-search-sign-language, + .orbit-bar-menu { + display: block; + } + } + } + } + #open-orbit-login { + &:checked { + &~.cover { + display: block; + } + &~.login-window { + display: block; + } + } + } + .cover { + display: none; + position: fixed; + top: 0; + right: 0; + bottom: 0; + left: 0; + background-color: rgba(0, 0, 0, .8); + z-index: 10 + } + .login-window { + display: none; + position: absolute; + top: 10em; + left: 50%; + width: 400px; + z-index: 10; + background-color: #fff; + margin-left: -200px; + border-radius: 5px; + box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5); + .login-header { + padding: 10px 15px; + border-bottom: 1px solid lighten($orbit-bar-bgc, 60%); + .close { + float: right; + font-size: 20px; + font-weight: bold; + line-height: 20px; + cursor: pointer; + color: lighten($orbit-bar-bgc, 60%); + &:hover { + color: lighten($orbit-bar-bgc, 40%); + } + } + h3 { + color: $orbit-bar-bgc-lighter; + margin: 0; + } + } + .login-body { + padding: 15px; + text-align: center; + form { + width: 312px; + margin: 0 auto; + } + .input-prepend { + margin-bottom: 15px; + .add-on { + color: #8D8D8D; + border-radius: 4px 0 0 4px; + margin-right: -5px; + display: inline-block; + width: 30px; + height: 30px; + min-width: 16px; + padding: 4px 5px; + font-size: 14px; + font-weight: normal; + line-height: 20px; + text-align: center; + text-shadow: 0 1px 0 #ffffff; + background-color: #eeeeee; + border: 1px solid #ccc; + white-space: nowrap; + } + .input-xlarge { + display: inline-block; + position: relative; + width: 250px; + height: 30px; + vertical-align: top; + border-radius: 0 4px 4px 0; + background-color: #ffffff; + border: 1px solid #cccccc; + box-shadow: inset 0 1px 1px rgba(0,0,0,0.075); + margin-left: 0; + padding: 4px 6px; + font-size: 14px; + line-height: 20px; + color: #555555; + white-space: nowrap; + } + } + .submit { + button { + display: inline-block; + padding: 4px 12px; + margin-bottom: 0; + font-size: 14px; + line-height: 20px; + color: #FFF; + outline: none; + text-align: center; + vertical-align: middle; + cursor: pointer; + background-color: #006dcc; + border: 1px solid #bbbbbb; + border-color: #e6e6e6 #e6e6e6 #bfbfbf; + border-color: rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25); + border-radius: 4px; + box-shadow: inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05); + &:hover { + background-color: #0044cc; + } + &:active { + box-shadow: inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05); + } + } + } + } + } + .orbit-bar-inner { + height: 40px; + padding: 0 15px; + position: relative; + background-color: $orbit-bar-bgc; + @include clearfix(); + a { + text-decoration: none; + } + & > label { + display: none; + position: absolute; + width: 23px; + height: 23px; + margin-top: 7px; + padding: 0 1px 0 0; + color: lighten($orbit-bar-bgc, 40%); + text-align: center; + border: 1px solid lighten($orbit-bar-bgc, 40%); + border-radius: 3px; + cursor: pointer; + &:hover { + color: lighten($orbit-bar-bgc, 90%); + border-color: lighten($orbit-bar-bgc, 90%); + } + i { + font-size: 1.2em; + line-height: 23px; + } + } + & > ul { + position: relative; + margin: 0 -15px; + padding: 0; + list-style: none; + @include clearfix(); + & > li { + position: relative; + float: left; + display: inline-block; + &:hover { + padding-bottom: 10px; + & > a, & > span, & > label { + background-color: #0095CF; + } + & > ul { + display: block; + } + } + & > ul { + display: none; + position: absolute; + top: 100%; + margin: 0; + padding: 0.5em 0; + background-color: #FFF; + list-style: none; + border-radius: 5px; + border: 1px solid lighten($orbit-bar-bgc, 60%); + box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.4); + &:before { + content: ""; + position: absolute; + top: -7px; + left: 10px; + width: 0; + height: 0; + display: block; + border-style: solid; + border-width: 0 8px 8px 8px; + border-color: transparent transparent #ffffff transparent; + } + li { + min-width: 100px; + padding: 0 0.8em; + &.divider { + height: 1px; + margin: 0.3em 0; + background-color: lighten($orbit-bar-bgc, 60%); + } + &:hover, &.active { + background-color: #0095CF; + a { + color: #FFF; + } + } + } + a { + color: $orbit-bar-bgc-lighter; + font-size: 0.8em; + display: block; + padding: 0.5em 0; + } + } + } + } + } + .orbit-bar-menu { + float: left; + .orbit-bar-logo { + @extend .orbitMenuLink; + padding: 0; + background-position: center; + background-repeat: no-repeat; + background-image: url(/assets/orbit-logo.svg); + background-image: url(/assets/orbit-logo.png)\9; + & + ul { + left: 0; + } + } + .orbit-bar-home { + @extend .orbitMenuLink; + padding: 0; + } + } + .orbit-bar-title { + display: none; + top: 0; + margin: 0 2em; + padding: 0.3em 0; + color: #FFF; + font-size: 1.4em; + text-align: center; + text-overflow: ellipsis; + white-space: nowrap; + overflow: hidden; + a { + color: #FFF; + } + } + .orbit-bar-search-sign-language { + float: right; + #search { + @extend .orbitMenuLink; + cursor: default; + width: auto; + text-align: right; + input[type="search"] { + color: $orbit-bar-bgc-lighter; + border: none; + border-radius: 1.7em; + line-height: 1.3em; + padding: 0.2em 0.8em; + outline: none; + } + } + #language, #user, label { + @extend .orbitMenuLink; + width: auto; + font-size: 0.8em; + & + ul { + right: 0; + &:before { + right: 10px; + left: auto; + } + } + } + label { + padding: 0; + } + } +} + @media (max-width: 479px) { #orbit-bar { .login-window { diff --git a/app/controllers/admin/sites_controller.rb b/app/controllers/admin/sites_controller.rb index 0155228..24a8fff 100644 --- a/app/controllers/admin/sites_controller.rb +++ b/app/controllers/admin/sites_controller.rb @@ -118,7 +118,11 @@ class Admin::SitesController < OrbitAdminController # end unless params[:site][:in_use_locales].nil? - params[:site][:in_use_locales] = params[:site][:in_use_locales].map{|locale| locale.to_sym} + in_user_locales = [] + I18n.available_locales.each do |locale| + in_user_locales << locale if params[:site][:in_use_locales][locale].eql?("1") + end + params[:site][:in_use_locales] = in_user_locales end if params[:site][:phone_number].nil? diff --git a/app/templates/orbit_bootstrap/assets/stylesheets/unit/_main-menu.scss b/app/templates/orbit_bootstrap/assets/stylesheets/unit/_main-menu.scss index d84daa0..2f703fe 100644 --- a/app/templates/orbit_bootstrap/assets/stylesheets/unit/_main-menu.scss +++ b/app/templates/orbit_bootstrap/assets/stylesheets/unit/_main-menu.scss @@ -36,8 +36,22 @@ } } } + .dropdown { + &:hover { + position: relative; + & > a { + color: #74A6BD; + background: #ffffff; + } + ul { + &[data-menu-level] { + display: block; + } + } + } + } .dropdown-menu { - top: 120%; + top: 100%; border: 4px solid rgba(0, 0, 0, 0.1); border-radius: 0; @include box-shadow(none); diff --git a/app/views/admin/sites/preference.html.erb b/app/views/admin/sites/preference.html.erb index fc55301..ffffd5c 100644 --- a/app/views/admin/sites/preference.html.erb +++ b/app/views/admin/sites/preference.html.erb @@ -160,7 +160,7 @@
<% I18n.available_locales.each do |valid_locale| %> - <%= check_box_tag "site[in_use_locales][]", valid_locale, @site.in_use_locales.include?(valid_locale), :class=>"toggle-check in_use_locales", :data => { :title => "#{t(valid_locale.to_s)}", disabled: true }, "data-deploy"=>"inline" %> + <%= check_box_tag "site[in_use_locales][#{valid_locale}]", valid_locale, @site.in_use_locales.include?(valid_locale), :class=>"toggle-check in_use_locales", :data => { :title => "#{t(valid_locale.to_s)}", disabled: true }, "data-deploy"=>"inline" %> <% end %>
diff --git a/app/views/orbit_bar/index.html.erb b/app/views/orbit_bar/index.html.erb index ccb63ac..312cd99 100644 --- a/app/views/orbit_bar/index.html.erb +++ b/app/views/orbit_bar/index.html.erb @@ -10,20 +10,20 @@
@@ -44,18 +44,18 @@ @@ -70,7 +70,8 @@