rounded out work on restart lesson and finished implementing showSource/showHints through UI, now that they come as metadata for a lesson
This commit is contained in:
parent
4ff73d0215
commit
867b692f52
@ -115,9 +115,9 @@
|
|||||||
<a ng-click="accordionMenu(item.id)" href=""><i class="fa {{item.class}}"></i><span>{{item.name}}</span></a><!-- expanded = !expanded-->
|
<a ng-click="accordionMenu(item.id)" href=""><i class="fa {{item.class}}"></i><span>{{item.name}}</span></a><!-- expanded = !expanded-->
|
||||||
<ul class="slideDown lessonsAndStages {{item.displayClass}}" id="{{item.id}}" isOpen=0>
|
<ul class="slideDown lessonsAndStages {{item.displayClass}}" id="{{item.id}}" isOpen=0>
|
||||||
<li ng-repeat="lesson in item.children" class="{{lesson.selectedClass}}">
|
<li ng-repeat="lesson in item.children" class="{{lesson.selectedClass}}">
|
||||||
<a ng-click="renderLesson(lesson.id,lesson.link)" id="{{lesson.id}}" class="{{lesson.selectedClass}}" title="link to {{lesson.name}}" href="">{{lesson.name}}</a><span class="{{lesson.completeClass}}"></span>
|
<a ng-click="renderLesson(lesson.id,lesson.link,{showSource:lesson.showSource,showHints:lesson.showHints})" id="{{lesson.id}}" class="{{lesson.selectedClass}}" title="link to {{lesson.name}}" href="">{{lesson.name}}</a><span class="{{lesson.completeClass}}"></span>
|
||||||
<span ng-repeat="stage in lesson.children">
|
<span ng-repeat="stage in lesson.children">
|
||||||
<a ng-click="renderLesson(lesson.id,stage.link)" class="selectedClass" id="{{stage.id}}" title="link to {{stage.name}}" href="">{{stage.name}}</a><span class="{{stage.completeClass}}"></span>
|
<a ng-click="renderLesson(stage.id,stage.link,{showSource:stage.showSource,showHints:stage.showHints})" class="selectedClass" id="{{stage.id}}" title="link to {{stage.name}}" href="">{{stage.name}}</a><span class="{{stage.completeClass}}"></span>
|
||||||
</span>
|
</span>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
@ -135,11 +135,11 @@
|
|||||||
<div class="col-md-12" align="left">
|
<div class="col-md-12" align="left">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<button type="button" id="showSourceBtn" class="btn btn-primary btn-xs" ng-click="showLessonSource()">Java [Source]</button>
|
<button type="button" id="showSourceBtn" ng-show="showSource" class="btn btn-primary btn-xs" ng-click="showLessonSource()">Java [Source]</button>
|
||||||
<button type="button" id="showSolutionBtn" class="btn btn-primary btn-xs" ng-click="showLessonSolution()">Solution</button>
|
<button type="button" id="showSolutionBtn" class="btn btn-primary btn-xs" ng-click="showLessonSolution()">Solution</button>
|
||||||
<button type="button" id="showPlanBtn" class="btn btn-primary btn-xs" ng-click="showLessonPlan()">Lesson Plan</button>
|
<button type="button" id="showPlanBtn" class="btn btn-primary btn-xs" ng-click="showLessonPlan()">Lesson Plan</button>
|
||||||
<button type="button" id="showHintsBtn" class="btn btn-primary btn-xs" ng-click="viewHints()">Hints</button>
|
<button type="button" id="showHintsBtn" ng-show="showHints" class="btn btn-primary btn-xs" ng-click="viewHints()">Hints</button>
|
||||||
<button type="button" id="restartLessonBtn" class="btn btn-xs" ng-click="restartLesson()">Restart Lesson</button>
|
<button type="button" id="restartLessonBtn" class="btn btn-xs" ng-click="restartLesson()">Restart Lesson</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="lessonHelp" id="lesson_hint_row">
|
<div class="lessonHelp" id="lesson_hint_row">
|
||||||
@ -149,7 +149,7 @@
|
|||||||
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="showPrevHintBtn" ng-click="viewPrevHint()"></span>
|
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-left" id="showPrevHintBtn" ng-click="viewPrevHint()"></span>
|
||||||
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="showNextHintBtn" ng-click="viewNextHint()"></span>
|
<span class="glyphicon-class glyphicon glyphicon-circle-arrow-right" id="showNextHintBtn" ng-click="viewNextHint()"></span>
|
||||||
<br/>
|
<br/>
|
||||||
<span bind-html-unsafe="curHint"></span>
|
<span ng-show="showHints" bind-html-unsafe="curHint"></span>
|
||||||
<!--<span id="curHintContainer"></span>-->
|
<!--<span id="curHintContainer"></span>-->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,9 +24,11 @@ var goatConstants = {
|
|||||||
menuService: 'service/lessonmenu.mvc',
|
menuService: 'service/lessonmenu.mvc',
|
||||||
lessonTitleService: 'service/lessontitle.mvc',
|
lessonTitleService: 'service/lessontitle.mvc',
|
||||||
restartLessonService: 'service/restartlesson.mvc',
|
restartLessonService: 'service/restartlesson.mvc',
|
||||||
// literals
|
|
||||||
|
// literal messages
|
||||||
notFound: 'Could not find',
|
notFound: 'Could not find',
|
||||||
noHints: 'There are no hints defined.'
|
noHints: 'There are no hints defined.',
|
||||||
|
noSourcePulled: 'No source was retrieved for this lesson'
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,9 +64,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.renderLesson = function(id,url) {
|
$scope.renderLesson = function(id,url,showControls) {//TODO convert to single object parameter
|
||||||
//console.log(url + ' was passed in');
|
|
||||||
// use jquery to render lesson content to div
|
|
||||||
$scope.hintIndex = 0;
|
$scope.hintIndex = 0;
|
||||||
var curScope = $scope;
|
var curScope = $scope;
|
||||||
$('.lessonHelp').hide();
|
$('.lessonHelp').hide();
|
||||||
@ -89,7 +87,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
|
|||||||
goat.utils.ajaxifyAttackHref();
|
goat.utils.ajaxifyAttackHref();
|
||||||
$('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here
|
$('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here
|
||||||
//notifies goatLesson Controller of the less change
|
//notifies goatLesson Controller of the less change
|
||||||
$scope.$emit('lessonUpdate',{params:curScope.parameters});
|
$scope.$emit('lessonUpdate',{params:curScope.parameters,'showControls':showControls});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
$scope.renderMenu();
|
$scope.renderMenu();
|
||||||
@ -123,6 +121,8 @@ var goatLesson = function($scope,$http,$log) {
|
|||||||
|
|
||||||
$scope.$on('lessonUpdate',function(params){
|
$scope.$on('lessonUpdate',function(params){
|
||||||
$scope.parameters = arguments[1].params;
|
$scope.parameters = arguments[1].params;
|
||||||
|
$scope.showHints = (arguments[1].showControls && arguments[1].showControls.showHints);
|
||||||
|
$scope.showSource = (arguments[1].showControls && arguments[1].showControls.showSource);
|
||||||
curScope = $scope; //TODO .. update below, this curScope is probably not needed
|
curScope = $scope; //TODO .. update below, this curScope is probably not needed
|
||||||
goat.data.loadCookies($http).then(
|
goat.data.loadCookies($http).then(
|
||||||
function(resp) {
|
function(resp) {
|
||||||
@ -131,22 +131,32 @@ var goatLesson = function($scope,$http,$log) {
|
|||||||
);
|
);
|
||||||
//hints
|
//hints
|
||||||
curScope.hintIndex = 0;
|
curScope.hintIndex = 0;
|
||||||
goat.data.loadHints($http).then(
|
if ($scope.showHints) {
|
||||||
function(resp) {
|
goat.data.loadHints($http).then(
|
||||||
curScope.hints = resp.data;
|
function(resp) {
|
||||||
if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) {
|
curScope.hints = resp.data;
|
||||||
goat.utils.displayButton('showHintsBtn', true);
|
if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) {
|
||||||
} else {
|
goat.utils.displayButton('showHintsBtn', true);
|
||||||
goat.utils.displayButton('showHintsBtn', false);
|
} else {
|
||||||
|
goat.utils.displayButton('showHintsBtn', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
);
|
||||||
);
|
} else {
|
||||||
|
$scope.hints = null;
|
||||||
|
goat.utils.displayButton('showHintsBtn', false);
|
||||||
|
}
|
||||||
//source
|
//source
|
||||||
goat.data.loadSource($http).then(
|
if ($scope.showSource) {
|
||||||
|
goat.data.loadSource($http).then(
|
||||||
function(resp) {
|
function(resp) {
|
||||||
curScope.source = resp.data;
|
curScope.source = resp.data;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
} else {
|
||||||
|
$scope.source = goatConstants.noSourcePulled;
|
||||||
|
}
|
||||||
|
|
||||||
//plan
|
//plan
|
||||||
goat.data.loadPlan($http).then(
|
goat.data.loadPlan($http).then(
|
||||||
function(resp) {
|
function(resp) {
|
||||||
@ -239,7 +249,7 @@ var goatLesson = function($scope,$http,$log) {
|
|||||||
$scope.restartLesson = function () {
|
$scope.restartLesson = function () {
|
||||||
goat.data.loadRestart($http).then(
|
goat.data.loadRestart($http).then(
|
||||||
function(resp) {
|
function(resp) {
|
||||||
angular.element($('#leftside-navigation')).scope().renderLesson(null,resp.data);
|
angular.element($('#leftside-navigation')).scope().renderLesson(null,resp.data,{showSource:$scope.showSource,showHints:$scope.showHints});
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user