<div id="Header" >
  <!-- logo -->
  <div class="logo fl" >
    <a href="#" target="_blank">
      <%=link_to image_tag("/images/logo.png",weight:"35px", height: "30px")%>
    </a>
  </div>

  <!-- 导航栏 -->
  <div id="TopNav" class="fl">
    <%= render_dynamic_nav if User.current.logged? || !Setting.login_required? -%>
  </div>

  <div id="TopUser" class="fr">
    <div id="menu">
      <ul class="menu">
        <!--右侧登录、登出、注册按钮-->
        <% if User.current.logged? -%>

            <li id="current_user_li">
              <%= link_to "#{User.current.login}<span class='pic_triangle'></span>".html_safe, {:controller=> 'users', :action => 'show', id: User.current.id, host: Setting.host_user}, target:"_blank", :class => "uses_name"%>
              <ul id="user_sub_menu" style="right: 0px;display: none;">
                <% if @show_course == 1 %>
                    <% user_course = get_user_course User.current%>
                    <% unless user_course.empty? %>
                        <li  id="my_courses_li">
                          <%=link_to l(:label_my_course), {:controller => 'users', :action => 'user_courses', id: User.current.id},target:"_blank", :class => "parent"  %>
                          <ul id="my_courses_ul">
                            <% user_course.each do |course| %>
                                <li title="<%=course.name%>">
                                  <%= link_to course.name, {:controller => 'courses',:action => 'show',:id => course.id},target:"_blank" %>
                                </li>
                            <% end %>
                          </ul>
                        </li>
                    <% end %>
                <% end %>

                <% unless User.current.projects.empty? %>
                    <li id="my_projects_li">
                      <%= link_to l(:label_my_projects), {:controller => 'users', :action => 'user_projects', id: User.current.id, host: Setting.host_name},target:"_blank", :class => "parent" %>
                      <ul id="my_projects_ul" >
                        <% User.current.projects.select("projects.*,(SELECT MAX(created_at)  FROM `forge_activities` WHERE forge_activities.project_id = projects.id) AS a").order("a desc").each do |project| %>
                            <li title="<%=project.name%>">
                              <%= link_to project.name, {:controller => 'projects', :action => 'show',id: project.id, host: Setting.host_name }, target:"_blank" %>
                            </li>
                        <% end %>
                      </ul>
                    </li>
                <% end %>
                <li>
                  <%=link_to l(:label_user_edit), {:controller => 'my', :action=> 'account', host: Setting.host_user}%>
                </li>
              </ul>
            </li>



        <% end -%>
        <%= header_render_menu :account_menu -%>
      </ul>
    </div><!--topuser_nav end-->
  </div>
</div>