Merge pull request #1091 from jhominal/master
Use `last_version` instead of `versions` when possible. Fixes #1087.
This commit is contained in:
+1
-1
@@ -496,7 +496,7 @@ module Precious
|
|||||||
|
|
||||||
# Extensions and layout data
|
# Extensions and layout data
|
||||||
@editable = true
|
@editable = true
|
||||||
@page_exists = !page.versions.empty?
|
@page_exists = !page.last_version.nil?
|
||||||
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
@toc_content = wiki.universal_toc ? @page.toc_data : nil
|
||||||
@mathjax = wiki.mathjax
|
@mathjax = wiki.mathjax
|
||||||
@h1_title = wiki.h1_title
|
@h1_title = wiki.h1_title
|
||||||
|
|||||||
@@ -22,15 +22,13 @@ module Precious
|
|||||||
end
|
end
|
||||||
|
|
||||||
def author
|
def author
|
||||||
page_versions = @page.versions
|
first = page.last_version
|
||||||
first = page_versions ? page_versions.first : false
|
|
||||||
return DEFAULT_AUTHOR unless first
|
return DEFAULT_AUTHOR unless first
|
||||||
first.author.name.respond_to?(:force_encoding) ? first.author.name.force_encoding('UTF-8') : first.author.name
|
first.author.name.respond_to?(:force_encoding) ? first.author.name.force_encoding('UTF-8') : first.author.name
|
||||||
end
|
end
|
||||||
|
|
||||||
def date
|
def date
|
||||||
page_versions = @page.versions
|
first = page.last_version
|
||||||
first = page_versions ? page_versions.first : false
|
|
||||||
return Time.now.strftime(DATE_FORMAT) unless first
|
return Time.now.strftime(DATE_FORMAT) unless first
|
||||||
first.authored_date.strftime(DATE_FORMAT)
|
first.authored_date.strftime(DATE_FORMAT)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user