Skip to content

Commit

Permalink
Merge pull request #870 from vladnicoara/manage-localization
Browse files Browse the repository at this point in the history
LBSD-141 JSONP fix
  • Loading branch information
nistormihai committed Sep 23, 2014
2 parents e30629b + fc00fcb commit 8c6b8e8
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions plugins/livedesk/gui-resources/scripts/js/localization-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ define([
config.guiJs('livedesk', 'authorization'),
'interceptor'
], function($, angular, Gizmo, auth, interceptor){

function getGizmoUrl(path) {
var url = new Gizmo.Url(path);
return url.get();
Expand Down Expand Up @@ -46,17 +47,14 @@ define([
return getGizmoUrl('Admin/Plugin/livedesk_embed/PO/'+po);
}
lc.getVersion = function() {
var deffered = $q.defer();
var versionLocation = getGizmoUrl('content/lib/embed/scripts/js/version.js');
versionLocation = versionLocation.replace('resources/','');
var rand = Math.floor((Math.random() * 10000) + 1);
$http.get(versionLocation + '?version=' + rand).success(function(data){
var clean = data.replace('liveblog.callbackVersion(', '');
clean = clean.replace(');', '');
clean = JSON.stringify(eval("(" + clean + ")"));
deffered.resolve(clean);
});
return deffered.promise;
window.liveblog = {};
liveblog.callbackVersion = function(data) {
this.versionObject = data;
};
return $http.jsonp(versionLocation + '?version=' + rand);
}
return lc;
});
Expand Down Expand Up @@ -114,8 +112,8 @@ define([
$scope.switchActionText = true;
actionText = _('Checking version');
$scope.actionText = actionText.toString();
locService.getVersion().then(function(data){
var versionObject = JSON.parse( data );
locService.getVersion().finally(function(data){
var versionObject = liveblog.versionObject;
var intlParam = $scope.myLang + '?version=' + versionObject.major + '.' + versionObject.minor + '.' + versionObject.revision
actionText = _('Creating internationalization cache');
$scope.actionText = actionText.toString();
Expand Down

0 comments on commit 8c6b8e8

Please sign in to comment.