Fix a bug when setting the site

Fix devise login
This commit is contained in:
chris 2013-04-29 20:17:44 +08:00
parent e028791d68
commit 67bb08c338
4 changed files with 18 additions and 5 deletions

View File

@ -0,0 +1,7 @@
// This is a manifest file that'll be compiled into including all the files listed below.
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
// be included in the compiled file accessible from http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// the compiled file.
//
//= require back_end

View File

@ -0,0 +1,6 @@
/*
*This is a manifest file that'll automatically include all the stylesheets available in this directory
*and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
*the top of the compiled file, but it's generally better to create a new file per style scope.
*= require back_end
*/

View File

@ -13,7 +13,7 @@ class ApplicationController < ActionController::Base
layout :layout_by_resource
helper :admin, :orbit_form
before_filter :set_locale, :set_site, :prepare_for_mobile
before_filter :set_site, :set_locale, :prepare_for_mobile
helper_attr :site_valid_locales
@ -135,10 +135,10 @@ class ApplicationController < ActionController::Base
if LIST[:forbidden_item_names].include?(env['PATH_INFO'].split('/')[1].to_s)
condition = VALID_LOCALES.include?(session[:locale])
elsif session[:locale]
condition = @site_in_use_locales.include?(session[:locale])
condition = @site.in_use_locales.include?(session[:locale])
else
browser_locale = request.env['HTTP_ACCEPT_LANGUAGE'].scan(/^[a-z]{2}/).first rescue nil
condition = @site_in_use_locales.include?(browser_locale)
condition = @site.in_use_locales.include?(browser_locale)
end
session[:locale] = condition ? (browser_locale || session[:locale]) : I18n.default_locale.to_s
I18n.locale = session[:locale].to_sym

View File

@ -57,13 +57,13 @@
<span class="add-on">
<i class="icon-user"></i>
</span>
<input class="input-xlarge" id="user_email" type="text" placeholder="<%= t(:email) %>">
<%= f.text_field :email, class: "input-xlarge" , placeholder: t(:email) %>
</div>
<div class="input-prepend">
<span class="add-on">
<i class="icon-lock"></i>
</span>
<input class="input-xlarge" id="user_email" type="password" placeholder="<%= t(:password) %>">
<%= f.password_field :password, class: "input-xlarge", placeholder: t(:password) %>
</div>
<div class="pull-left" style="width: 150px;">
<!-- <label class="checkbox">