diff options
author | Marin Jankovski <marin@gitlab.com> | 2014-04-28 18:22:31 +0400 |
---|---|---|
committer | Marin Jankovski <marin@gitlab.com> | 2014-04-28 18:22:31 +0400 |
commit | c4b1a5f5ea338d9be6b24f29a562b567b3c2598b (patch) | |
tree | 505b2ac5bd4d38b16e3b471e2c398f5f24617cc5 /app/models/project_wiki.rb | |
parent | 0050c07fdda59f36ca2959e08d422ff5d6479e10 (diff) |
Allow nested files in wiki.
Diffstat (limited to 'app/models/project_wiki.rb')
-rw-r--r-- | app/models/project_wiki.rb | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/models/project_wiki.rb b/app/models/project_wiki.rb index 163302a18f7..08a52782475 100644 --- a/app/models/project_wiki.rb +++ b/app/models/project_wiki.rb @@ -64,7 +64,8 @@ class ProjectWiki # # Returns an initialized WikiPage instance or nil def find_page(title, version = nil) - if page = wiki.page(title, version) + page_title, page_dir = page_title_and_dir(title) + if page = wiki.page(page_title, version, page_dir) WikiPage.new(self, page, true) else nil @@ -90,6 +91,12 @@ class ProjectWiki wiki.delete_page(page, commit_details(:deleted, message, page.title)) end + def page_title_and_dir(title) + title_array = title.split("/") + title = title_array.pop + [title.gsub(/\.[^.]*$/, ""), title_array.join("/")] + end + private def create_repo! |