Merge branch 'sw_new_course' of http://repository.trustie.net/xianbo/trustie2 into sw_new_course

This commit is contained in:
sw 2015-08-25 16:35:51 +08:00
commit 5ce89aa8bc
3 changed files with 14 additions and 5 deletions

View File

@ -25,7 +25,7 @@ class AccountController < ApplicationController
# Login request and validation # Login request and validation
def login def login
if request.get? if request.get?
@login = params[:login] @login = params[:login] || true
if User.current.logged? if User.current.logged?
redirect_to home_url redirect_to home_url
else else
@ -39,10 +39,10 @@ class AccountController < ApplicationController
# Log out current user and redirect to welcome page # Log out current user and redirect to welcome page
def logout def logout
if User.current.anonymous? if User.current.anonymous?
redirect_to home_url redirect_to signin_path
elsif request.post? elsif request.post?
logout_user logout_user
redirect_to home_url redirect_to signin_path
end end
# display the logout form # display the logout form
end end

View File

@ -50,7 +50,9 @@
<ul class="topnav_login_list"> <ul class="topnav_login_list">
<li><a href="javascript:void(0);" class="menuGrey">修改资料</a> </li> <li><a href="javascript:void(0);" class="menuGrey">修改资料</a> </li>
<!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>--> <!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
<li><a href="<%= signout_path %>" class="menuGrey" >退出</a></li> <li>
<%= link_to "退出",signout_path,:class => "menuGrey",:method => "post"%>
</li>
</ul> </ul>
</li> </li>
</ul> </ul>
@ -71,4 +73,11 @@
}).mouseout(function(){ }).mouseout(function(){
$("#navHomepageSearchType").hide(); $("#navHomepageSearchType").hide();
}); });
function signout(){
$.post(
'<%= signout_path%>',
{}
);
}
</script> </script>

View File

@ -7,7 +7,7 @@
<meta name="keywords" content="issue,bug,tracker" /> <meta name="keywords" content="issue,bug,tracker" />
<%= csrf_meta_tag %> <%= csrf_meta_tag %>
<%= favicon %> <%= favicon %>
<%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_public', 'user_leftside', :media => 'all' %> <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_user', 'user_leftside', :media => 'all' %>
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
<%= javascript_heads %> <%= javascript_heads %>
<%= javascript_include_tag "bootstrap","avatars","new_user"%> <%= javascript_include_tag "bootstrap","avatars","new_user"%>