wikis: add "tag history", "wiki history", "what links here" sidebar options.
This commit is contained in:
@@ -76,6 +76,10 @@ class WikiPage < ApplicationRecord
|
||||
q = q.tag_matches(params[:tag])
|
||||
end
|
||||
|
||||
if params[:linked_to].present?
|
||||
q = q.where(id: DtextLink.wiki_link.where(link_target: params[:linked_to]).select(:model_id))
|
||||
end
|
||||
|
||||
if params[:hide_deleted].to_s.truthy?
|
||||
q = q.where("is_deleted = false")
|
||||
end
|
||||
@@ -165,6 +169,10 @@ class WikiPage < ApplicationRecord
|
||||
title.starts_with?(*META_WIKIS)
|
||||
end
|
||||
|
||||
def is_meta_wiki?
|
||||
WikiPage.is_meta_wiki?(title)
|
||||
end
|
||||
|
||||
def wiki_page_changed?
|
||||
saved_change_to_title? || saved_change_to_body? || saved_change_to_is_locked? || saved_change_to_is_deleted? || saved_change_to_other_names?
|
||||
end
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
<% content_for(:sidebar) do %>
|
||||
<%= render "posts/partials/index/blacklist" %>
|
||||
<%= render "wiki_pages/recent_changes" %>
|
||||
|
||||
<% if @wiki_page.present? %>
|
||||
<h4>Options</h4>
|
||||
|
||||
<ul class="list-bulleted">
|
||||
<% unless @wiki_page.is_meta_wiki? %>
|
||||
<li><%= link_to "Tag History", post_versions_path(search: { changed_tags: @wiki_page.title }) %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Wiki History", wiki_page_versions_path(search: { wiki_page_id: @wiki_page.id }) %></li>
|
||||
<li><%= link_to "What Links Here", wiki_pages_path(search: { linked_to: @wiki_page.title }) %></li>
|
||||
</ul>
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user