76aad9b76e
Make the following changes to deal with new behavior in Rails 4.1.2: * Use nested resources to avoid slashes in arguments to path helpers.
26 lines
564 B
Ruby
26 lines
564 B
Ruby
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)
|
|
namespace_project_issue_url(namespace_id: issue.project.namespace,
|
|
id: issue.iid,
|
|
project_id: issue.project,
|
|
host: Gitlab.config.gitlab['url'])
|
|
end
|
|
end
|
|
end
|