show lesson solution
This commit is contained in:
@ -31,65 +31,21 @@ goat.controller('goatLesson', function($scope, $http, $modal, $log, $templateCac
|
||||
if ($('div.panel-body').height() > 400) {
|
||||
$('#leftside-navigation').height($(window).height());
|
||||
}
|
||||
// hook into our pseudo service calls
|
||||
// @TODO make these real services during phase 2
|
||||
// show cookies and params
|
||||
goat.utils.showLessonCookiesAndParams();
|
||||
// show hints
|
||||
goat.utils.showLessonHint();
|
||||
// show plan
|
||||
goat.utils.showLessonPlan();
|
||||
// show solution
|
||||
goat.utils.showLessonSolution();
|
||||
// show source
|
||||
goat.utils.showLessonSource();
|
||||
}
|
||||
);
|
||||
};
|
||||
//TODO: Move show Source into it's own angular controller
|
||||
/*
|
||||
* Function to load lesson source
|
||||
* @returns {undefined}
|
||||
*/
|
||||
$scope.showSource = function(size) {
|
||||
// fetch source from web service
|
||||
$http.get('service/source.mvc').success(function(data) {
|
||||
$scope.lessonSource = data.source;
|
||||
$scope.openSourceModal(size);
|
||||
}).error(function(data) {
|
||||
$scope.lessonSource = data.message;
|
||||
console.log("LessonSource = '" + data.message + "'");
|
||||
$scope.openSourceModal(size);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.openSourceModal = function(size) {
|
||||
var modalInstance = $modal.open({
|
||||
templateUrl: 'showSource.html',
|
||||
controller: showSourceController,
|
||||
size: size,
|
||||
resolve: {
|
||||
lessonSource: function() {
|
||||
return $scope.lessonSource;
|
||||
}
|
||||
}
|
||||
});
|
||||
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';
|
||||
return {
|
||||
|
@ -18,11 +18,36 @@ goat.utils = {
|
||||
/**goatApp.extractLessonTitle
|
||||
*pulls lesson title from html fragment returned (looks for it in h1 element)
|
||||
*@param - html rendered to object passed in
|
||||
*/
|
||||
extractLessonTitle:function (el) {
|
||||
var title = $('h1',el).text();
|
||||
*/
|
||||
extractLessonTitle: function(el) {
|
||||
var title = $('h1', el).text();
|
||||
return title;
|
||||
},
|
||||
showLessonCookiesAndParams: function() {
|
||||
$.get("service/cookies_widget.mvc", {}, function(reply) {
|
||||
$("#lesson_cookies").html(reply);
|
||||
}, "html");
|
||||
},
|
||||
showLessonHint: function() {
|
||||
$.get("service/hint_widget.mvc", {}, function(reply) {
|
||||
$("#lesson_hint").html(reply);
|
||||
}, "html");
|
||||
},
|
||||
showLessonSource: function() {
|
||||
$.get("service/source.mvc", {}, function(reply) {
|
||||
$("#lesson_source").html(reply);
|
||||
}, "html");
|
||||
},
|
||||
showLessonSolution: function() {
|
||||
$.get("service/solution.mvc", {}, function(reply) {
|
||||
$("#lesson_solution").html(reply);
|
||||
}, "html");
|
||||
},
|
||||
showLessonPlan: function() {
|
||||
$.get("service/lessonplan.mvc", {}, function(reply) {
|
||||
$("#lesson_plan").html(reply);
|
||||
}, "html");
|
||||
}
|
||||
};
|
||||
|
||||
// ### GLOBAL FUNCTIONS ## //
|
||||
|
Reference in New Issue
Block a user