Welcome to mirror list, hosted at ThFree Co, Russian Federation.

wiki_helper.rb « gitlab « helpers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 02a1daf0019d4df2bda7c48879d224320e35261c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
module Gitlab
  module WikiHelper
    # Rails v4.1.9+ escapes all model IDs, converting slashes into %2F. The
    # only way around this is to implement our own path generators.
    def namespace_project_wiki_path(namespace, project, wiki_page, *args)
      slug =
          case wiki_page
          when Symbol
            wiki_page
          when String
            wiki_page
          else
            wiki_page.slug
          end
      namespace_project_path(namespace, project) + "/wikis/#{slug}"
    end

    def edit_namespace_project_wiki_path(namespace, project, wiki_page, *args)
      namespace_project_wiki_path(namespace, project, wiki_page) + '/edit'
    end

    def history_namespace_project_wiki_path(namespace, project, wiki_page, *args)
      namespace_project_wiki_path(namespace, project, wiki_page) + '/history'
    end
  end
end