Skip to content

Commit

Permalink
Merge pull request #1660 from geoadmin/gal_shorten_cors
Browse files Browse the repository at this point in the history
Use cors to shorten URLs (and fix CORS hack)
  • Loading branch information
cedricmoullet committed Sep 18, 2014
2 parents 275fd8d + ed63029 commit fcaa529
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/components/print/PrintDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@
return parseInt(scale.value);
});
var that = this;
$http.jsonp($scope.options.shortenUrl, {
$http.get($scope.options.shortenUrl, {
params: {
url: gaPermalink.getHref()
}
Expand Down
11 changes: 4 additions & 7 deletions src/components/share/ShareDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,21 @@
goog.provide('ga_share_directive');

goog.require('ga_permalink');
goog.require('ga_urlutils_service');

var module = angular.module('ga_share_directive', [
'ga_permalink',
'ga_urlutils_service'
'ga_permalink'
]);

module.directive('gaShare',
function($http, $window, gaPermalink, gaUrlUtils) {
function($http, $window, gaPermalink) {
return {
restrict: 'A',
scope: {
options: '=gaShareOptions'
},
templateUrl: 'components/share/partials/share.html',
link: function(scope, element, attrs) {
var shortenUrl = gaUrlUtils.append(scope.options.shortenUrl,
'cb=JSON_CALLBACK');
var shortenUrl = scope.options.shortenUrl;
scope.qrcodegeneratorPath = scope.options.qrcodegeneratorPath;

$('.ga-share-icon').tooltip({
Expand Down Expand Up @@ -58,7 +55,7 @@
// Function to shorten url
// Make an asynchronous request to url shortener
scope.shortenUrl = function() {
$http.jsonp(shortenUrl, {
$http.get(shortenUrl, {
params: {
url: scope.permalinkValue
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/PrintController.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
encodeURIComponent(printPath),
legendUrl: gaGlobalOptions.apiUrl + '/static/images/legends/',
qrcodeUrl: gaGlobalOptions.apiUrl + '/qrcodegenerator?url=',
shortenUrl: gaGlobalOptions.apiUrl + '/shorten.json?cb=JSON_CALLBACK',
shortenUrl: gaGlobalOptions.apiUrl + '/shorten.json',
markerUrl: gaGlobalOptions.resourceUrl + 'img/marker.png',
heightMargin: $('#header').height(),
widthMargin: $('#pulldown').width(),
Expand Down
16 changes: 13 additions & 3 deletions src/lib/angularIE9CorsFix.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fcaa529

Please sign in to comment.