fixing my mess from earlier. hints, plans, solutions etc. working again. params still quirky

This commit is contained in:
Jason White 2014-09-15 22:16:26 -06:00
parent 149e7ecc40
commit 80b776f7fd
3 changed files with 49 additions and 50 deletions

View File

@ -62,7 +62,7 @@
</head> </head>
<body class="animated fadeIn" ng-app="goatApp"> <body class="animated fadeIn" ng-app="goatApp">
<section id="container"> <section id="container" ng-controller="goatLesson">
<header id="header"> <header id="header">
<!--logo start--> <!--logo start-->
<div class="brand"> <div class="brand">
@ -128,7 +128,7 @@
<!--sidebar left end--> <!--sidebar left end-->
<!--main content start--> <!--main content start-->
<section class="main-content-wrapper"> <section class="main-content-wrapper">
<section id="main-content" ng-controller="goatLesson"> <section id="main-content" > <!--ng-controller="goatLesson"-->
<div class="row"> <div class="row">
<div class="col-md-8"> <div class="col-md-8">
<div class="col-md-12" align="left"> <div class="col-md-12" align="left">

View File

@ -3,12 +3,7 @@
/* ### GOAT CONTROLLERS ### */ /* ### GOAT CONTROLLERS ### */
/** Lesson Controller (includes menu stuff) /* menu controller */
* prepares and updates menu topic items for the view
*/
//<<<<<<< Updated upstream
//goat.controller('goatLesson', function($scope, $http, $modal, $log, $sce) { //$templateCache
//=======
var goatMenu = function($scope, $http, $modal, $log, $templateCache) { var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
$scope.cookies = []; $scope.cookies = [];
$scope.params = []; $scope.params = [];
@ -36,7 +31,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
// use jquery to render lesson content to div // use jquery to render lesson content to div
$scope.hintIndex = 0; $scope.hintIndex = 0;
var curScope = $scope; var curScope = $scope;
$('.lessonHelp').hide();
curScope.parameters = goat.utils.scrapeParams(url); curScope.parameters = goat.utils.scrapeParams(url);
goat.data.loadLessonContent($http,url).then( goat.data.loadLessonContent($http,url).then(
function(reply) { function(reply) {
@ -47,6 +42,7 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
); );
$("#lesson_content").html(reply.data); $("#lesson_content").html(reply.data);
$('#leftside-navigation').height($('#main-content').height()+15) $('#leftside-navigation').height($('#main-content').height()+15)
$scope.$emit('lessonUpdate',{params:curScope.parameters});
} }
)}; )};
$scope.accordionMenu = function(id) { $scope.accordionMenu = function(id) {
@ -86,53 +82,55 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
});*/ });*/
/* lesson controller */
var goatLesson = function($scope,$http,$log) { var goatLesson = function($scope,$http,$log) {
//hook forms //hook forms
$('#hintsView').hide(); $('#hintsView').hide();
// adjust menu to lessonContent size if necssary // adjust menu to lessonContent size if necssary
//@TODO: this is still clunky ... needs some TLC //cookies
if ($('div.panel-body').height() > 400) {
$('#leftside-navigation').height($(window).height()); $scope.$on('lessonUpdate',function(params){
$scope.parameters = arguments[1];
curScope = $scope; //TODO .. update below, this curScope is probably not needed
goat.data.loadCookies($http).then(
function(resp) {
curScope.cookies = resp.data;
} }
//cookies );
goat.data.loadCookies($http).then( //hints
function(resp) { curScope.hintIndex = 0;
curScope.cookies = resp.data; goat.data.loadHints($http).then(
} function(resp) {
); curScope.hints = resp.data;
//hints if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) {
curScope = $scope; //TODO .. update below, this curScope is probably not needed goat.utils.displayButton('showHintsBtn', true);
curScope.hintIndex = 0; } else {
goat.data.loadHints($http).then( goat.utils.displayButton('showHintsBtn', false);
function(resp) { }
curScope.hints = resp.data; }
if (curScope.hints.length > 0 && curScope.hints[0].hint.indexOf(goatConstants.noHints) === -1) { );
goat.utils.displayButton('showHintsBtn', true); //source
} else { goat.data.loadSource($http).then(
goat.utils.displayButton('showHintsBtn', false); function(resp) {
} curScope.source = resp.data;
} }
); );
//source //plan
goat.data.loadSource($http).then( goat.data.loadPlan($http).then(
function(resp) { function(resp) {
curScope.source = resp.data; curScope.plan = resp.data;
} }
); );
//plan //solution
goat.data.loadPlan($http).then( goat.data.loadSolution($http).then(
function(resp) { function(resp) {
curScope.plan = resp.data; curScope.solution = resp.data;
} }
); );
//solution });
goat.data.loadSolution($http).then(
function(resp) { //goat.utils.scrollToTop();
curScope.solution = resp.data;
}
);
goat.utils.scrollToTop();
$scope.showLessonSource = function() { $scope.showLessonSource = function() {

View File

@ -53,6 +53,7 @@ goat.utils = {
goat.utils.scrollToHelp(); goat.utils.scrollToHelp();
}, },
scrollToHelp:function() { scrollToHelp:function() {
$('#leftside-navigation').height($('#main-content').height()+15)
var target = $('#lessonHelpsWrapper'); var target = $('#lessonHelpsWrapper');
goat.utils.scrollEasy(target); goat.utils.scrollEasy(target);
}, },