Skip to content

Commit

Permalink
resolve sharing trek url
Browse files Browse the repository at this point in the history
  • Loading branch information
bastien committed Dec 9, 2016
1 parent 3fc1cc5 commit f473039
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/scripts/trek/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,21 @@ geotrekTreks.controller('TrekController',
};

$scope.share = function () {
console.log($scope.trek)
socialSharingService.share(
$scope.trek.properties.name+' : ',
$scope.trek.properties.name, null,
settings.PUBLIC_WEBSITE + '/' + $scope.trek.properties.slug
settings.PUBLIC_WEBSITE + '/' + accentsTidy($scope.trek.properties.practice.label) + '/' + $scope.trek.properties.slug
);
};

function accentsTidy(s){
var r = s.toLowerCase();
var non_asciis = {'a': '[àáâãäå]', 'ae': 'æ', 'c': 'ç', 'e': '[èéêë]', 'i': '[ìíîï]', 'n': 'ñ', 'o': '[òóôõö]', 'oe': 'œ', 'u': '[ùúûűü]', 'y': '[ýÿ]'};
for (var i in non_asciis) { r = r.replace(new RegExp(non_asciis[i], 'g'), i); }
return r;
};

function downloadError(error, currentTrek) {
console.error(error);
currentTrek.tiles.inDownloadProgress = false;
Expand Down

0 comments on commit f473039

Please sign in to comment.