2014-06-13 06:34:15 -04:00
|
|
|
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)
|
2015-01-24 13:02:58 -05:00
|
|
|
namespace_project_issue_url(namespace_id: issue.project.namespace,
|
|
|
|
id: issue.iid,
|
|
|
|
project_id: issue.project,
|
|
|
|
host: Gitlab.config.gitlab['url'])
|
2014-06-13 06:34:15 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|