Skip to content

Commit 80b776f

Browse files
author
Jason White
committed
fixing my mess from earlier. hints, plans, solutions etc. working again. params still quirky
1 parent 149e7ec commit 80b776f

File tree

3 files changed

+49
-50
lines changed

3 files changed

+49
-50
lines changed

src/main/webapp/WEB-INF/pages/main_new.jsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
</head>
6363

6464
<body class="animated fadeIn" ng-app="goatApp">
65-
<section id="container">
65+
<section id="container" ng-controller="goatLesson">
6666
<header id="header">
6767
<!--logo start-->
6868
<div class="brand">
@@ -128,7 +128,7 @@
128128
<!--sidebar left end-->
129129
<!--main content start-->
130130
<section class="main-content-wrapper">
131-
<section id="main-content" ng-controller="goatLesson">
131+
<section id="main-content" > <!--ng-controller="goatLesson"-->
132132
<div class="row">
133133
<div class="col-md-8">
134134
<div class="col-md-12" align="left">

src/main/webapp/js/goatControllers.js

Lines changed: 46 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@
33

44
/* ### GOAT CONTROLLERS ### */
55

6-
/** Lesson Controller (includes menu stuff)
7-
* prepares and updates menu topic items for the view
8-
*/
9-
//<<<<<<< Updated upstream
10-
//goat.controller('goatLesson', function($scope, $http, $modal, $log, $sce) { //$templateCache
11-
//=======
6+
/* menu controller */
127
var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
138
$scope.cookies = [];
149
$scope.params = [];
@@ -36,7 +31,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
3631
// use jquery to render lesson content to div
3732
$scope.hintIndex = 0;
3833
var curScope = $scope;
39-
34+
$('.lessonHelp').hide();
4035
curScope.parameters = goat.utils.scrapeParams(url);
4136
goat.data.loadLessonContent($http,url).then(
4237
function(reply) {
@@ -47,6 +42,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
4742
);
4843
$("#lesson_content").html(reply.data);
4944
$('#leftside-navigation').height($('#main-content').height()+15)
45+
$scope.$emit('lessonUpdate',{params:curScope.parameters});
5046
}
5147
)};
5248
$scope.accordionMenu = function(id) {
@@ -86,53 +82,55 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
8682
8783
});*/
8884

85+
/* lesson controller */
8986
var goatLesson = function($scope,$http,$log) {
9087
//hook forms
9188

9289
$('#hintsView').hide();
9390
// adjust menu to lessonContent size if necssary
94-
//@TODO: this is still clunky ... needs some TLC
95-
if ($('div.panel-body').height() > 400) {
96-
$('#leftside-navigation').height($(window).height());
91+
//cookies
92+
93+
$scope.$on('lessonUpdate',function(params){
94+
$scope.parameters = arguments[1];
95+
curScope = $scope; //TODO .. update below, this curScope is probably not needed
96+
goat.data.loadCookies($http).then(
97+
function(resp) {
98+
curScope.cookies = resp.data;
9799
}
98-
//cookies
99-
goat.data.loadCookies($http).then(
100-
function(resp) {
101-
curScope.cookies = resp.data;
102-
}
103-
);
104-
//hints
105-
curScope = $scope; //TODO .. update below, this curScope is probably not needed
106-
curScope.hintIndex = 0;
107-
goat.data.loadHints($http).then(
108-
function(resp) {
109-
curScope.hints = resp.data;
110-
if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) {
111-
goat.utils.displayButton('showHintsBtn', true);
112-
} else {
113-
goat.utils.displayButton('showHintsBtn', false);
114-
}
115-
}
116-
);
117-
//source
118-
goat.data.loadSource($http).then(
119-
function(resp) {
120-
curScope.source = resp.data;
121-
}
122-
);
123-
//plan
124-
goat.data.loadPlan($http).then(
125-
function(resp) {
126-
curScope.plan = resp.data;
127-
}
128-
);
129-
//solution
130-
goat.data.loadSolution($http).then(
131-
function(resp) {
132-
curScope.solution = resp.data;
133-
}
134-
);
135-
goat.utils.scrollToTop();
100+
);
101+
//hints
102+
curScope.hintIndex = 0;
103+
goat.data.loadHints($http).then(
104+
function(resp) {
105+
curScope.hints = resp.data;
106+
if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) {
107+
goat.utils.displayButton('showHintsBtn', true);
108+
} else {
109+
goat.utils.displayButton('showHintsBtn', false);
110+
}
111+
}
112+
);
113+
//source
114+
goat.data.loadSource($http).then(
115+
function(resp) {
116+
curScope.source = resp.data;
117+
}
118+
);
119+
//plan
120+
goat.data.loadPlan($http).then(
121+
function(resp) {
122+
curScope.plan = resp.data;
123+
}
124+
);
125+
//solution
126+
goat.data.loadSolution($http).then(
127+
function(resp) {
128+
curScope.solution = resp.data;
129+
}
130+
);
131+
});
132+
133+
//goat.utils.scrollToTop();
136134

137135

138136
$scope.showLessonSource = function() {

src/main/webapp/js/goatUtil.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ goat.utils = {
5353
goat.utils.scrollToHelp();
5454
},
5555
scrollToHelp:function() {
56+
$('#leftside-navigation').height($('#main-content').height()+15)
5657
var target = $('#lessonHelpsWrapper');
5758
goat.utils.scrollEasy(target);
5859
},

0 commit comments

Comments
 (0)