Pass the service url to tribe on send-to-tribe link

stable
Jesús Espino 2016-09-27 11:29:37 +02:00
parent 5ca24aa37b
commit e233736aea
2 changed files with 8 additions and 3 deletions

View File

@ -17,11 +17,16 @@
# File: tribe-button.directive.coffee
###
TribeButtonDirective = (configService) ->
TribeButtonDirective = (configService, locationService) ->
link = (scope, el, attrs) ->
scope.vm = {}
scope.vm.tribeHost = configService.config.tribeHost
scope.vm.url = "#{locationService.protocol()}://#{locationService.host()}"
if (locationService.protocol() == "http" and locationService.port() != 80)
scope.vm.url = "#{scope.vm.url}:#{locationService.port()}"
else if (locationService.protocol() == "https" and locationService.port() != 443)
scope.vm.url = "#{scope.vm.url}:#{locationService.port()}"
return {
scope: {usId: "=", projectSlug: "="}
@ -31,7 +36,7 @@ TribeButtonDirective = (configService) ->
}
TribeButtonDirective.$inject = [
"$tgConfig"
"$tgConfig", "$tgLocation"
]
angular.module("taigaComponents").directive("tgTribeButton", TribeButtonDirective)

View File

@ -1,5 +1,5 @@
a.button-tribe(
ng-href="{{::vm.tribeHost}}/taiga-integration/receive?project={{projectSlug}}&us={{usId}}",
ng-href="{{::vm.tribeHost}}/taiga-integration/receive?url={{::vm.url}}&project={{projectSlug}}&us={{usId}}",
title="{{ 'US.TRIBE.PUBLISH' | translate }}"
target="_blank"
)