Merge pull request #389 from taigaio/bug/2402/export-url-must-be-absolute
Bug#2402 Add resolveAbsolute method and used in csv export url buildingstable
commit
a616ef3c80
|
@ -640,7 +640,7 @@ class CsvExporterController extends taiga.Controller
|
||||||
@rootscope.$on("project:loaded", @.setCsvUuid)
|
@rootscope.$on("project:loaded", @.setCsvUuid)
|
||||||
@scope.$watch "csvUuid", (value) =>
|
@scope.$watch "csvUuid", (value) =>
|
||||||
if value
|
if value
|
||||||
@scope.csvUrl = @urls.resolve("#{@.type}-csv", value)
|
@scope.csvUrl = @urls.resolveAbsolute("#{@.type}-csv", value)
|
||||||
else
|
else
|
||||||
@scope.csvUrl = ""
|
@scope.csvUrl = ""
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,14 @@ class UrlsService extends taiga.Service
|
||||||
_.str.ltrim(url, "/")
|
_.str.ltrim(url, "/")
|
||||||
])
|
])
|
||||||
|
|
||||||
|
resolveAbsolute: ->
|
||||||
|
url = @.resolve.apply(@, arguments)
|
||||||
|
if (/^https?:\/\//i).test(url)
|
||||||
|
return url
|
||||||
|
if (/^\//).test(url)
|
||||||
|
return "#{window.location.protocol}//#{window.location.host}#{url}"
|
||||||
|
return "#{window.location.protocol}//#{window.location.host}/#{url}"
|
||||||
|
|
||||||
|
|
||||||
module = angular.module("taigaBase")
|
module = angular.module("taigaBase")
|
||||||
module.service('$tgUrls', UrlsService)
|
module.service('$tgUrls', UrlsService)
|
||||||
|
|
Loading…
Reference in New Issue