restart Lesson button implemented and attack link modification for CSRF lesson
This commit is contained in:
@ -139,6 +139,7 @@
|
|||||||
<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" 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>
|
</div>
|
||||||
<div class="lessonHelp" id="lesson_hint_row">
|
<div class="lessonHelp" id="lesson_hint_row">
|
||||||
@ -351,6 +352,7 @@
|
|||||||
// make any embedded forms ajaxy
|
// make any embedded forms ajaxy
|
||||||
goat.utils.showLessonCookiesAndParams();
|
goat.utils.showLessonCookiesAndParams();
|
||||||
goat.utils.makeFormsAjax();
|
goat.utils.makeFormsAjax();
|
||||||
|
goat.utils.ajaxifyAttackHref(); //TODO find some way to hook scope for current menu. Likely needs larger refactor which is already started/stashed
|
||||||
//refresh menu
|
//refresh menu
|
||||||
angular.element($('#leftside-navigation')).scope().renderMenu();
|
angular.element($('#leftside-navigation')).scope().renderMenu();
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,7 @@ var goatConstants = {
|
|||||||
lessonPlanService:'service/lessonplan.mvc',
|
lessonPlanService:'service/lessonplan.mvc',
|
||||||
menuService: 'service/lessonmenu.mvc',
|
menuService: 'service/lessonmenu.mvc',
|
||||||
lessonTitleService: 'service/lessontitle.mvc',
|
lessonTitleService: 'service/lessontitle.mvc',
|
||||||
|
restartLessonService: 'service/restartlesson.mvc',
|
||||||
// literals
|
// literals
|
||||||
notFound: 'Could not find',
|
notFound: 'Could not find',
|
||||||
noHints: 'There are no hints defined.'
|
noHints: 'There are no hints defined.'
|
||||||
|
@ -85,7 +85,8 @@ var goatMenu = function($scope, $http, $modal, $log, $templateCache) {
|
|||||||
//TODO encode html or get angular js portion working
|
//TODO encode html or get angular js portion working
|
||||||
$("#lesson_content").html(reply.data);
|
$("#lesson_content").html(reply.data);
|
||||||
//hook forms
|
//hook forms
|
||||||
goat.utils.makeFormsAjax();
|
goat.utils.makeFormsAjax();// inject form?
|
||||||
|
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});
|
||||||
@ -235,6 +236,14 @@ 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);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
$scope.showAbout = function() {
|
$scope.showAbout = function() {
|
||||||
$('#aboutModal').modal({
|
$('#aboutModal').modal({
|
||||||
//remote: 'about.mvc'
|
//remote: 'about.mvc'
|
||||||
|
@ -36,5 +36,9 @@ goat.data = {
|
|||||||
},
|
},
|
||||||
loadLessonTitle: function ($http) {
|
loadLessonTitle: function ($http) {
|
||||||
return $http({method: 'GET', url: goatConstants.lessonTitleService});
|
return $http({method: 'GET', url: goatConstants.lessonTitleService});
|
||||||
|
},
|
||||||
|
loadRestart: function ($http) {
|
||||||
|
return $http({method: 'GET', url:goatConstants.restartLessonService})
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -91,8 +91,23 @@ goat.utils = {
|
|||||||
makeId: function (lessonName) {
|
makeId: function (lessonName) {
|
||||||
return lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g,'');//TODO move the replace routine into util function
|
return lessonName.replace(/\s|\(|\)|\!|\:|\;|\@|\#|\$|\%|\^|\&|\*/g,'');//TODO move the replace routine into util function
|
||||||
},
|
},
|
||||||
ajaxifyAttackHREF: function () {
|
ajaxifyAttackHref: function () {
|
||||||
// stub for dealing with CSRF lesson link issues and other similar issues
|
$.each($('a[href^="attack?"]'),
|
||||||
|
function(i,el) {
|
||||||
|
var url = $(el).attr('href');
|
||||||
|
$(el).attr('href','#');
|
||||||
|
$(el).attr('link',url);
|
||||||
|
//TODO pull currentMenuId
|
||||||
|
$(el).click(
|
||||||
|
function() {
|
||||||
|
var _url = $(el).attr('link');
|
||||||
|
$.get(_url, {success:showResponse});
|
||||||
|
//return $.get(_url, {}, null, "html");
|
||||||
|
//angular.element($('#leftside-navigation')).scope().renderLesson(curMenuItem,url);
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user