diff --git a/app/presenters/wiki_page_presenter.rb b/app/presenters/wiki_page_presenter.rb index 31b9d22da..723127142 100644 --- a/app/presenters/wiki_page_presenter.rb +++ b/app/presenters/wiki_page_presenter.rb @@ -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)|(?:.+?)') diff --git a/app/views/wiki_pages/show.html.erb b/app/views/wiki_pages/show.html.erb index 542e2522e..7c5bc4907 100644 --- a/app/views/wiki_pages/show.html.erb +++ b/app/views/wiki_pages/show.html.erb @@ -22,6 +22,14 @@ <% if @wiki_page.presenter.consequent_tag_aliases.any? %>

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(", ") %>.

<% end %> + + <% if @wiki_page.presenter.antecedent_tag_implication %> +

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) %>.

+ <% end %> + + <% if @wiki_page.presenter.consequent_tag_implications.any? %> +

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(", ") %>.

+ <% end %>