组织页首增加退出功能

This commit is contained in:
ouyangxuhua 2015-12-07 14:31:08 +08:00
parent c229104d78
commit 7057a4cfea
2 changed files with 32 additions and 4 deletions

View File

@ -43,7 +43,16 @@
<%#= link_to '首页', organization_path(@organization, :show_homepage => 1),:class=>"linkGrey8 f14" %> <%#= link_to '首页', organization_path(@organization, :show_homepage => 1),:class=>"linkGrey8 f14" %>
</li> </li>
<% if User.current.logged? %> <% if User.current.logged? %>
<li class="navOrgMenu fr"><%=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li> <li class="navOrgMenu fr" id="orgSwitch" style="cursor:pointer;">
<span class="orgMenuArrow" id="orgArrow">
<ul class="org_login_list" style="display:none;">
<li> <%= link_to "个人主页",user_path(User.current), :class => "linkGrey8" %></li>
<li><%= link_to "退出",signout_path, :class =>"linkGrey8", :method => 'post', :rel => "nofollow" %></li>
</ul>
</span>
</li>
<li class="navOrgMenu fr" id="orgUser" style="cursor:pointer;"><%=link_to User.current, user_path(User.current), :class => "linkGrey8 f14", :id => "orgUserName" %></li>
<!--<li class="navOrgMenu fr"><%#=link_to User.current, user_path(User.current), :class => "linkGrey8 f14" %></li>-->
<% else %> <% else %>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>true) %>" class="linkGrey8 f14">登录</a></li> <li class="navOrgMenu fr"><a href="<%= signin_path(:login=>true) %>" class="linkGrey8 f14">登录</a></li>
<li class="navOrgMenu fr"><a href="<%= signin_path(:login=>false) %>" class="linkGrey8 f14 mr15">注册</a></li> <li class="navOrgMenu fr"><a href="<%= signin_path(:login=>false) %>" class="linkGrey8 f14 mr15">注册</a></li>
@ -183,10 +192,25 @@
} }
else else
{ {
alert("您还没有设置首页! 您可以把您喜欢的文章设为组织首页。"); alert("您还未设置首页!");
} }
} }
</script> $(document).ready(function(){
$("#orgUser,#orgSwitch").click(function(){
$(".org_login_list").toggle();
if($("#orgArrow").attr("class") == "orgMenuArrow"){
$("#orgArrow").attr("class","orgMenuArrow2");
}
else {
$("#orgArrow").attr("class","orgMenuArrow") ;
}
});
if($(".org_login_list").children().click){
$(".org_login_list").css("display","none");
$("#orgArrow").attr("class","orgMenuArrow");
};
});
</script>
</body> </body>
</html> </html>

View File

@ -64,4 +64,8 @@ a.cancelBtn:hover {background-color:#717171; color:#ffffff;}
a.linkGrey8 {color:#888888;} a.linkGrey8 {color:#888888;}
a.linkGrey8:hover {color:#585858;} a.linkGrey8:hover {color:#585858;}
.orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;} .orgBorder {width:583px; height:21px; border-bottom:3px solid #e4e4e4; float:left;}
.orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;} .orgListRow {border-bottom:1px solid #e4e4e4; padding-bottom:5px; color:#555555;}
.orgMenuArrow {background:url(../images/nav_icon.png) -10px -165px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
.orgMenuArrow2 {background:url(../images/nav_icon.png) -10px -132px no-repeat; position:relative; display:inline-block; width:20px; height:30px;}
.org_login_list{ border:1px solid #eaeaea; background:#fff; padding-left:10px; padding-bottom:10px; padding-top:8px; width:60px; left:-53px; position:absolute; z-index:9999; line-height:2; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); margin-top: 30px;}
#orgUserName {max-width:50px; overflow:hidden; white-space: nowrap; text-overflow: ellipsis; display:inline-block;}