Skip to content

Commit

Permalink
Merge pull request #99 from e-ucm/littleltifix
Browse files Browse the repository at this point in the history
Fixed undefined var (lti launch url) in the new interface
  • Loading branch information
Dan Cristian, Rotaru committed Oct 19, 2018
2 parents 057af2b + b33e9e7 commit 85c84f9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/public/js/controllers/class.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ angular.module('classApp', ['ngStorage', 'services', 'ngAnimate', 'ngSanitize',
};

$attrs.$observe('classid', function() {
var myPrefix = $location.$$absUrl.split('/')[5];
$scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port +
'/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX;
getClassInfo();
});

Expand Down Expand Up @@ -171,17 +174,16 @@ angular.module('classApp', ['ngStorage', 'services', 'ngAnimate', 'ngSanitize',
$scope.lti.key = '';
$scope.lti.secret = '';

var myPrefix = $location.$$path.split('/')[3];
$scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port +
'/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX;

$scope.createLtiKey = function () {
if ($scope.lti.secret) {
$http.post(CONSTANTS.PROXY + '/lti', {
secret: $scope.lti.secret,
classId: $scope.class._id
}).success(function (data) {
$scope.lti.key = data._id;
var myPrefix = $location.$$absUrl.split('/')[5];
$scope.lti.launch = $location.$$protocol + '://' + $location.$$host + ':' + $location.$$port +
'/api/login/launch/' + myPrefix + '/' + CONSTANTS.PREFIX;
}).error(function (data, status) {
console.error('Error on get /lti' + JSON.stringify(data) + ', status: ' + status);
});
Expand Down

0 comments on commit 85c84f9

Please sign in to comment.