This commit is contained in:
Toks
2013-03-28 19:18:30 -04:00
parent 192acab5c3
commit 502de5a651
2 changed files with 16 additions and 0 deletions

View File

@@ -21,6 +21,14 @@ class WikiPagePresenter
@antecedent_tag_alias ||= TagAlias.where("status = 'active' and antecedent_name = ?", wiki_page.title).first
end
def consequent_tag_implications
@consequent_tag_implications ||= TagImplication.where("status = 'active' and consequent_name = ?", wiki_page.title).all
end
def antecedent_tag_implication
@antecedent_tag_implication ||= TagImplication.where("status = 'active' and antecedent_name = ?", wiki_page.title).first
end
# Produce a formatted page that shows the difference between two versions of a page.
def diff(other_version)
pattern = Regexp.new('(?:<.+?>)|(?:[0-9_A-Za-z\x80-\xff]+[\x09\x20]?)|(?:[ \t]+)|(?:\r?\n)|(?:.+?)')

View File

@@ -22,6 +22,14 @@
<% if @wiki_page.presenter.consequent_tag_aliases.any? %>
<p class="hint">The following tags are aliased to this tag: <%= raw @wiki_page.presenter.consequent_tag_aliases.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
<% end %>
<% if @wiki_page.presenter.antecedent_tag_implication %>
<p class="hint">This tag has been implicated to <%= link_to @wiki_page.presenter.antecedent_tag_implication.consequent_name, posts_path(:tags => @wiki_page.presenter.antecedent_tag_implication.consequent_name) %>.</p>
<% end %>
<% if @wiki_page.presenter.consequent_tag_implications.any? %>
<p class="hint">The following tags are implicated to this tag: <%= raw @wiki_page.presenter.consequent_tag_implications.map {|x| link_to(x.antecedent_name, posts_path(:tags => x.antecedent_name))}.join(", ") %>.</p>
<% end %>
</div>
<div id="wiki-page-posts">