alias_and_implication_list: refactor alias/implication lookup.
Add alias and implications associations to Tag. Use them in alias_and_implication list instead of duplicating the alias/implication lookup code.
This commit is contained in:
@@ -13,22 +13,6 @@ class WikiPagePresenter
|
||||
DText.strip(excerpt.to_s)
|
||||
end
|
||||
|
||||
def consequent_tag_aliases
|
||||
@consequent_tag_aliases ||= TagAlias.where("status in ('active', 'processing') and consequent_name = ?", wiki_page.title)
|
||||
end
|
||||
|
||||
def antecedent_tag_alias
|
||||
@antecedent_tag_alias ||= TagAlias.where("status in ('active', 'processing') and antecedent_name = ?", wiki_page.title).first
|
||||
end
|
||||
|
||||
def consequent_tag_implications
|
||||
@consequent_tag_implications ||= TagImplication.where("status in ('active', 'processing') and consequent_name = ?", wiki_page.title)
|
||||
end
|
||||
|
||||
def antecedent_tag_implications
|
||||
@antecedent_tag_implications ||= TagImplication.where("status in ('active', 'processing') and antecedent_name = ?", wiki_page.title)
|
||||
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)|(?:.+?)')
|
||||
|
||||
Reference in New Issue
Block a user