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:
		| @ -115,9 +115,9 @@ | ||||
|                             <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> | ||||
|                                 <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"> | ||||
|                                         <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> | ||||
|                                 </li> | ||||
|                             </ul> | ||||
| @ -135,11 +135,11 @@ | ||||
|                             <div class="col-md-12" align="left"> | ||||
|                                 <div class="panel"> | ||||
|                                     <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="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="restartLessonBtn" class="btn btn-xs"  ng-click="restartLesson()">Restart Lesson</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> | ||||
|                                     </div> | ||||
|                                 </div> | ||||
|                                 <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-right" id="showNextHintBtn" ng-click="viewNextHint()"></span> | ||||
|                                             <br/> | ||||
|                                             <span bind-html-unsafe="curHint"></span> | ||||
|                                             <span ng-show="showHints" bind-html-unsafe="curHint"></span> | ||||
|                                             <!--<span id="curHintContainer"></span>--> | ||||
|                                         </div>                                     | ||||
|                                     </div> | ||||
|  | ||||
| @ -24,9 +24,11 @@ var goatConstants = { | ||||
| 	menuService: 'service/lessonmenu.mvc', | ||||
| 	lessonTitleService: 'service/lessontitle.mvc', | ||||
| 	restartLessonService: 'service/restartlesson.mvc', | ||||
| 	// literals | ||||
| 	 | ||||
| 	// literal messages | ||||
| 	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) { | ||||
|         //console.log(url + ' was passed in'); | ||||
|         // use jquery to render lesson content to div | ||||
|     $scope.renderLesson = function(id,url,showControls) {//TODO convert to single object parameter | ||||
|         $scope.hintIndex = 0; | ||||
|         var curScope = $scope; | ||||
| 	$('.lessonHelp').hide(); | ||||
| @ -89,7 +87,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) { | ||||
| 		goat.utils.ajaxifyAttackHref(); | ||||
| 		$('#leftside-navigation').height($('#main-content').height()+15)//TODO: get ride of fixed value (15)here | ||||
| 		//notifies goatLesson Controller of the less change | ||||
| 		$scope.$emit('lessonUpdate',{params:curScope.parameters}); | ||||
| 		$scope.$emit('lessonUpdate',{params:curScope.parameters,'showControls':showControls}); | ||||
| 	    } | ||||
| 	) | ||||
| 	$scope.renderMenu();	 | ||||
| @ -123,6 +121,8 @@ var goatLesson = function($scope,$http,$log) { | ||||
| 	 | ||||
| 	$scope.$on('lessonUpdate',function(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 | ||||
| 	    goat.data.loadCookies($http).then( | ||||
| 		function(resp) { | ||||
| @ -131,22 +131,32 @@ var goatLesson = function($scope,$http,$log) { | ||||
| 	    ); | ||||
| 	    //hints | ||||
| 	    curScope.hintIndex = 0; | ||||
| 	    goat.data.loadHints($http).then( | ||||
| 		function(resp) { | ||||
| 		    curScope.hints = resp.data; | ||||
| 		    if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) { | ||||
| 			goat.utils.displayButton('showHintsBtn', true); | ||||
| 		    } else { | ||||
| 			goat.utils.displayButton('showHintsBtn', false); | ||||
| 	    if ($scope.showHints) { | ||||
| 		goat.data.loadHints($http).then( | ||||
| 		    function(resp) { | ||||
| 			curScope.hints = resp.data; | ||||
| 			if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) { | ||||
| 			    goat.utils.displayButton('showHintsBtn', true); | ||||
| 			} else { | ||||
| 			    goat.utils.displayButton('showHintsBtn', false); | ||||
| 			} | ||||
| 		    } | ||||
| 		} | ||||
| 	    ); | ||||
| 		); | ||||
| 	    } else { | ||||
| 		$scope.hints = null; | ||||
| 		goat.utils.displayButton('showHintsBtn', false); | ||||
| 	    } | ||||
| 	    //source | ||||
| 	    goat.data.loadSource($http).then( | ||||
| 	    if ($scope.showSource) { | ||||
| 		goat.data.loadSource($http).then( | ||||
| 		    function(resp) { | ||||
| 			curScope.source = resp.data; | ||||
| 		    } | ||||
| 	    ); | ||||
| 		); | ||||
| 	    } else { | ||||
| 		$scope.source = goatConstants.noSourcePulled; | ||||
| 	    } | ||||
| 	     | ||||
| 	    //plan | ||||
| 	    goat.data.loadPlan($http).then( | ||||
| 		    function(resp) { | ||||
| @ -239,7 +249,7 @@ var goatLesson = function($scope,$http,$log) { | ||||
|     $scope.restartLesson = function () { | ||||
| 	goat.data.loadRestart($http).then( | ||||
| 	    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}); | ||||
| 	    } | ||||
| 	) | ||||
|     } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user