Files
danbooru/app/views/wiki_pages/_secondary_links.html.erb

38 lines
2.3 KiB
Plaintext

<% content_for(:secondary_links) do %>
<%= quick_search_form_for(:title_normalize, wiki_pages_path, "wiki pages", autocomplete: "wiki-page", redirect: true) %>
<%= subnav_link_to "Listing", wiki_pages_path %>
<%= subnav_link_to "Search", search_wiki_pages_path %>
<% if policy(WikiPage).new? %>
<%= subnav_link_to "New", new_wiki_page_path %>
<% end %>
<%= subnav_link_to "Help", wiki_page_path("help:wiki") %>
<% if @wiki_page && @wiki_page.new_record? && @wiki_page.try(:tag).present? %>
<li>|</li>
<%= subnav_link_to "Posts (#{@wiki_page.tag.post_count})", posts_path(:tags => @wiki_page.title) %>
<% elsif @wiki_page && !@wiki_page.new_record? %>
<li>|</li>
<%= subnav_link_to "Posts (#{@wiki_page.tag.try(:post_count) || 0})", posts_path(:tags => @wiki_page.title) %>
<%= subnav_link_to "History", wiki_page_versions_path(:search => {:wiki_page_id => @wiki_page.id}) %>
<% if policy(@wiki_page).edit? %>
<%= subnav_link_to "Edit", edit_wiki_page_path(@wiki_page.id), "data-shortcut": "e" %>
<% if current_page?(action: :edit) %>
<% if @wiki_page.is_deleted? %>
<%= subnav_link_to "Undelete", wiki_page_path(@wiki_page.id), remote: true, method: :put, "data-params": "wiki_page[is_deleted]=false", "data-shortcut": "shift+d", "data-confirm": "Are you sure you want to undelete this wiki?" %>
<% else %>
<%= subnav_link_to "Delete", wiki_page_path(@wiki_page.id), remote: true, method: :put, "data-params": "wiki_page[is_deleted]=true", "data-shortcut": "shift+d", "data-confirm": "Are you sure you want to delete this wiki?" %>
<% end %>
<% end %>
<% end %>
<% elsif @wiki_page_version %>
<li>|</li>
<%= subnav_link_to "Newest", wiki_page_path(@wiki_page_version.wiki_page_id) %>
<% if @wiki_page_version.previous %>
<%= subnav_link_to "Diff", diff_wiki_page_versions_path(:otherpage => @wiki_page_version.id, :thispage => @wiki_page_version.previous.id) %>
<% end %>
<% if policy(@wiki_page_version.wiki_page).revert? %>
<%= subnav_link_to "Revert to", revert_wiki_page_path(@wiki_page_version.wiki_page_id, :version_id => @wiki_page_version.id), :method => :put, :data => {:confirm => "Are you sure you want to revert to this version?"} %>
<% end %>
<% end %>
<% end %>