<% content_for(:secondary_links) do %>
  <menu>
    <li><%= render "wiki_pages/quick_search" %></li>
    <li><%= link_to "Listing", wiki_pages_path %></li>
    <li><%= link_to "Search", search_wiki_pages_path %></li>
    
    <% if CurrentUser.is_member? %>
      <li><%= link_to "New", new_wiki_page_path %></li>
    <% end %>
    
    <li><%= link_to "Help", wiki_pages_path(:search => {:title => "help:wiki"}) %></li>
    
    <% if @wiki_page %>
      <li>|</li>
      <li><%= link_to "Posts (#{Post.fast_count(@wiki_page.title)})", posts_path(:tags => @wiki_page.title) %></li>
      <% unless @wiki_page.new_record? %>
        <li><%= link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %></li>
        <% if CurrentUser.is_member? %>
          <li><%= link_to "Edit", edit_wiki_page_path(@wiki_page) %></li>
        <% end %>
        <% if CurrentUser.is_janitor? %>
          <li><%= link_to "Delete", wiki_page_path(@wiki_page), :remote => true, :method => :delete, :confirm => "Are you sure you want to delete this wiki page?" %></li>
        <% end %>
      <% end %>
    <% end %>
    <% if @wiki_page_version %>
      <li>|</li>
      <li><%= link_to "Newest", wiki_page_path(@wiki_page_version.wiki_page_id) %></li>
      <% if CurrentUser.is_member? %>
        <li><%= link_to "Revert to", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put, :confirm => "Are you sure you want to revert to this version?" %></li>
      <% end %>
    <% end %>
  </menu>
<% end %>
