Getting the attack verification to work

This commit is contained in:
Nanne Baars
2016-08-08 19:38:24 +02:00
parent 34ffa62535
commit c0ab7b7d1c
6 changed files with 126 additions and 19 deletions

View File

@ -39,19 +39,29 @@ define(['jquery',
var self = this;
// The current LessonAdapter#getLink() generates a hash-mark link. It will not match the mask below.
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
$.each($('a[href^="attack?"]'),function(i,el) { //FIXME: need to figure out what to do here ...
var url = $(el).attr('href');
$(el).unbind('click').attr('href','#').attr('link',url);
//TODO pull currentMenuId
$(el).click(function(event) {
event.preventDefault();
var _url = $(el).attr('link');
console.log("About to GET " + _url);
$.get(_url)
.done(self.reLoadView.bind(self))
.fail(function() { alert("failed to GET " + _url); });
});
$('form').submit(function(event){
var url = this.baseURI;
url = url.replace('start.mvc#lesson', '');
url = url + '.attack';
$.get(url)
.done(self.reLoadView.bind(self))
.fail(function() { alert("failed to GET " + url); });
});
//
//
// $.each($('a[href^="*.attack"]'),function(i,el) { //FIXME: need to figure out what to do here ...
// var url = $(el).attr('href');
// $(el).unbind('click').attr('href','#').attr('link',url);
// //TODO pull currentMenuId
// $(el).click(function(event) {
// event.preventDefault();
// var _url = $(el).attr('link');
// console.log("About to GET " + _url);
// $.get(_url)
// .done(self.reLoadView.bind(self))
// .fail(function() { alert("failed to GET " + _url); });
// });
// });
},
onAttackExecution: function(feedback) {