show lesson solution
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/** Menu Controller
|
||||
* prepares and updates menu topic items for the view
|
||||
*/
|
||||
goat.controller('goatLesson', function($scope, $http, $modal, $log) {
|
||||
goat.controller('goatLesson', function($scope, $http, $modal, $log, $templateCache) {
|
||||
//TODO: implement via separate promise and use config for menu (goat.data.loadMenuData())
|
||||
$http({method: 'GET', url: goatConstants.lessonService}).then(
|
||||
function(menuData) {
|
||||
@ -33,15 +33,6 @@ goat.controller('goatLesson', function($scope, $http, $modal, $log) {
|
||||
}
|
||||
}
|
||||
);
|
||||
/*
|
||||
console.log("Updating Lesson Source...");
|
||||
$http.get('service/source.mvc').success(function(data) {
|
||||
$scope.lessonSource = data.source;
|
||||
}).error(function(data) {
|
||||
$scope.lessonSource = data.message;
|
||||
console.log("LessonSource = '" + data.message + "'");
|
||||
});
|
||||
*/
|
||||
};
|
||||
//TODO: Move show Source into it's own angular controller
|
||||
/*
|
||||
@ -56,10 +47,9 @@ goat.controller('goatLesson', function($scope, $http, $modal, $log) {
|
||||
}).error(function(data) {
|
||||
$scope.lessonSource = data.message;
|
||||
console.log("LessonSource = '" + data.message + "'");
|
||||
$scope.openSourceModal(size);
|
||||
})
|
||||
|
||||
}
|
||||
$scope.openSourceModal(size);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openSourceModal = function(size) {
|
||||
var modalInstance = $modal.open({
|
||||
@ -75,7 +65,30 @@ goat.controller('goatLesson', function($scope, $http, $modal, $log) {
|
||||
modalInstance.result.then(function() {
|
||||
$log.info('Modal dismissed at: ' + new Date());
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
* Function to load lesson solution
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.showSolution = function(size) {
|
||||
$scope.lessonSolutionUrl = "service/solution.mvc";
|
||||
// clear the template cache otherwise we display stale lesson solutions
|
||||
$templateCache.remove($scope.lessonSolutionUrl);
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'showSolution.html',
|
||||
controller: showSolutionController,
|
||||
size: size,
|
||||
resolve: {
|
||||
lessonSolutionUrl: function() {
|
||||
return $scope.lessonSolutionUrl;
|
||||
}
|
||||
}
|
||||
});
|
||||
modalInstance.result.then(function() {
|
||||
$log.info('Modal dismissed at: ' + new Date());
|
||||
});
|
||||
};
|
||||
|
||||
}).animation('.slideDown', function() {
|
||||
var NgHideClassName = 'ng-hide';
|
||||
@ -90,7 +103,7 @@ goat.controller('goatLesson', function($scope, $http, $modal, $log) {
|
||||
$(element).hide().slideDown(done);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@ -108,5 +121,19 @@ var showSourceController = function($scope, $modalInstance, lessonSource) {
|
||||
};
|
||||
};
|
||||
|
||||
var showSolutionController = function($scope, $modalInstance, lessonSolutionUrl) {
|
||||
|
||||
$scope.lessonSolutionUrl = lessonSolutionUrl;
|
||||
|
||||
$scope.ok = function() {
|
||||
$modalInstance.close();
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user