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

url_builder.rb « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: de7e040408617995b44ec397f3fad9d34d06008e (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
module Gitlab
  class UrlBuilder
    include Rails.application.routes.url_helpers

    def initialize(type)
      @type = type
    end

    def build(id)
      case @type
      when :issue
        issue_url(id)
      end
    end

    private

    def issue_url(id)
      issue = Issue.find(id)
      project_issue_url(id: issue.iid,
                        project_id: issue.project,
                        host: Settings.gitlab['url'])
    end
  end
end