<% if User.current.logged? %>
    <div class="navHomepageProfile" id="navHomepageProfile">
      <ul>
        <li class="homepageProfileMenuIcon fr sn-mt23" id="homepageProfileMenuIcon">
          <%= link_to "<div class='user-img' id='user_avatar'>#{image_tag(url_to_avatar(User.current), :class => "portraitRadius",:alt=>"头像", :id => "nh_user_logo")}</div>".html_safe, user_activities_path(User.current.id) %>
          <%#= link_to image_tag(url_to_avatar(User.current)), user_url_in_org(User.current.id), :alt => '用户头像', :target => '_blank', :class => "fr user-img" %>
          <ul class="topnav_login_list none sn-f12" id="topnav_login_list" style="text-align:left;">
            <li>
              <%= link_to "修改资料", my_account_path, :class => "menuGrey"%>
            </li>
            <li>
              <%= link_to "我的组织", user_organizations_user_path(:id => User.current.id), :class => "menuGrey"%>
            </li>
            <li>
              <%= link_to "新建组织", new_organization_path, :class => "menuGrey"%>
            </li>
            <!--<li><a href="javascript:void(0);" class="menuGrey">账号设置</a> </li>-->
            <li>
              <%= link_to "退出", logout_url_without_domain, :class => "menuGrey", :method => "post"%>
            </li>
          </ul>
        </li>
      </ul>
    </div>
<% else %>
    <div class="sn-fr">
      <a href="<%= signin_url_without_domain %>" class="sn-link-blue">登录</a>&nbsp;&nbsp;|&nbsp;&nbsp;
      <a href="<%= register_url_without_domain %>" class="sn-link-blue">注册</a>
    </div>
<% end %>

<script type="text/javascript">
    $("#navHomepageProfile").mouseenter(function(){
        $("#homepageProfileMenuIcon").addClass("homepageProfileMenuIconhover");
        $("#topnav_login_list").show();
    });
    $("#navHomepageProfile").mouseleave(function(){
        $("#homepageProfileMenuIcon").removeClass("homepageProfileMenuIconhover");
        $("#topnav_login_list").hide();
    });

    function signout(){
        $.post(
                '<%= signout_path%>',
                {}
        );
    }
</script>