<% content_for(:secondary_links) do %>
  <menu>
    <li><%= render "users/quick_search" %></li>
    <li><%= link_to "Listing", users_path %></li>
    <li><%= link_to "Search", search_users_path %></li>

    <% if CurrentUser.user.is_anonymous? %>
      <li><%= link_to "Sign up", new_user_path %></li>
    <% end %>

    <% if @user && !@user.new_record? && !CurrentUser.user.is_anonymous? %>
      <li>|</li>
      <% if @user.id == CurrentUser.user.id %>
        <li><%= link_to "Settings", edit_user_path(CurrentUser.user) %></li>
        <li><%= link_to "Profile", user_path(CurrentUser.user) %></li>
        <li><%= link_to "Messages #{CurrentUser.user.dmail_count}", dmails_current_folder_path %></li>

        <% if !@user.is_platinum? %>
          <li><%= link_to "Upgrade", new_user_upgrade_path %></li>
        <% end %>
      <% else %>
        <li><%= link_to "Send message", new_dmail_path(:dmail => {:to_id => @user.id}) %></li>
        <% if !@user.is_platinum? %>
          <li><%= link_to "Gift upgrade", new_user_upgrade_path(:user_id => @user.id) %></li>
        <% end %>
      <% end %>

      <% if CurrentUser.user.is_moderator? %>
        <li><%= link_to "Promote", edit_admin_user_path(@user) %></li>
        <% if @user.is_banned? %>
          <li><%= link_to "Unban", ban_path(@user.recent_ban) %></li>
        <% else %>
          <li><%= link_to "Ban", new_ban_path(:ban => {:user_id => @user.id}) %></li>
        <% end %>
      <% end %>

      <li>|</li>
      <li><%= link_to "Sign out", sign_out_session_path %></li>
    <% end %>
  </menu>
<% end %>
