diff options
Diffstat (limited to 'app/models/wiki_page.rb')
-rw-r--r-- | app/models/wiki_page.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/wiki_page.rb b/app/models/wiki_page.rb index aeacb6f8995..e970cfbfff8 100644 --- a/app/models/wiki_page.rb +++ b/app/models/wiki_page.rb @@ -88,6 +88,12 @@ class WikiPage end end + # The hierarchy of the directory this page is contained in. + def directory + dir = wiki.page_title_and_dir(slug).last + dir.present? ? dir : '/' + end + # The processed/formatted content of this page. def formatted_content @attributes[:formatted_content] ||= if @page @@ -100,6 +106,11 @@ class WikiPage @attributes[:format] || :markdown end + # The full path for this page, including its filename and extension. + def full_path + "/#{directory}/#{page.filename}".gsub(/\/+/, '/') + end + # The commit message for this page version. def message version.try(:message) |