initial support for separation of content from attack in UI
This commit is contained in:
parent
63398aaf6d
commit
0aa94a71e5
@ -925,4 +925,10 @@ cookie-container {
|
|||||||
|
|
||||||
.help-button {
|
.help-button {
|
||||||
margin-right:4px;
|
margin-right:4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ATTACK DISPLAY */
|
||||||
|
|
||||||
|
div.attack-container {
|
||||||
|
display:none;
|
||||||
}
|
}
|
@ -98,10 +98,11 @@ define(['jquery',
|
|||||||
hasPlan:this.lessonInfoModel.get('hasPlan'),
|
hasPlan:this.lessonInfoModel.get('hasPlan'),
|
||||||
hasSolution:this.lessonInfoModel.get('hasSolution'),
|
hasSolution:this.lessonInfoModel.get('hasSolution'),
|
||||||
hasSource:this.lessonInfoModel.get('hasSource'),
|
hasSource:this.lessonInfoModel.get('hasSource'),
|
||||||
hasHints:(this.lessonInfoModel.get('numberHints') > 0),
|
hasHints:(this.lessonInfoModel.get('numberHints') > 0)
|
||||||
|
//hasAttack:this.lessonInfo.get('hasAttack') // TODO: add attack options
|
||||||
});
|
});
|
||||||
|
|
||||||
this.listenTo(this.helpControlsView,'plan:show',this.hideShowHelps);
|
this.listenTo(this.helpControlsView,'attack:show',this.hideShowAttack);
|
||||||
this.listenTo(this.helpControlsView,'solution:show',this.hideShowHelps);
|
this.listenTo(this.helpControlsView,'solution:show',this.hideShowHelps);
|
||||||
this.listenTo(this.helpControlsView,'hints:show',this.onShowHints)
|
this.listenTo(this.helpControlsView,'hints:show',this.onShowHints)
|
||||||
this.listenTo(this.helpControlsView,'source:show',this.hideShowHelps);
|
this.listenTo(this.helpControlsView,'source:show',this.hideShowHelps);
|
||||||
@ -128,7 +129,6 @@ define(['jquery',
|
|||||||
this.lessonHintView = new HintView();
|
this.lessonHintView = new HintView();
|
||||||
this.cookieView = new CookieView();
|
this.cookieView = new CookieView();
|
||||||
|
|
||||||
|
|
||||||
//TODO: instantiate model with values (not sure why was not working before)
|
//TODO: instantiate model with values (not sure why was not working before)
|
||||||
var paramModel = new ParamModel({});
|
var paramModel = new ParamModel({});
|
||||||
paramModel.set('scrParam',this.lessonContent.get('scrParam'));
|
paramModel.set('scrParam',this.lessonContent.get('scrParam'));
|
||||||
@ -180,6 +180,12 @@ define(['jquery',
|
|||||||
this.lessonHintView.render();
|
this.lessonHintView.render();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.hideShowAttack = function (options) { // will likely expand this to encompass
|
||||||
|
if (options.show) {
|
||||||
|
$('div.attack-container').show();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.restartLesson = function() {
|
this.restartLesson = function() {
|
||||||
var self=this;
|
var self=this;
|
||||||
var fragment = "attack/" + self.scr + "/" + self.menu;
|
var fragment = "attack/" + self.scr + "/" + self.menu;
|
||||||
|
@ -29,8 +29,8 @@ function($,_,Backbone) {
|
|||||||
if (this.hasSolution) {
|
if (this.hasSolution) {
|
||||||
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
|
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
|
||||||
}
|
}
|
||||||
if (this.hasPlan) {
|
if (true) { //FIXME: change to this.hasAttack
|
||||||
this.$el.find('#show-plan-button').unbind().on('click',_.bind(this.showPlan,this)).show();
|
this.$el.find('#show-attack-button').unbind().on('click',_.bind(this.showAttack,this)).show();
|
||||||
}
|
}
|
||||||
if (this.hasHints) {
|
if (this.hasHints) {
|
||||||
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
this.$el.find('#show-hints-button').unbind().on('click',_.bind(this.showHints,this)).show();
|
||||||
@ -48,8 +48,8 @@ function($,_,Backbone) {
|
|||||||
this.trigger('solution:show','solution');
|
this.trigger('solution:show','solution');
|
||||||
},
|
},
|
||||||
|
|
||||||
showPlan: function() {
|
showAttack: function() {
|
||||||
this.trigger('plan:show','plan');
|
this.trigger('attack:show',{show:true});
|
||||||
},
|
},
|
||||||
|
|
||||||
showHints: function() {
|
showHints: function() {
|
||||||
|
@ -25,14 +25,14 @@ define(['jquery',
|
|||||||
//TODO: reimplement this in custom fashion maybe?
|
//TODO: reimplement this in custom fashion maybe?
|
||||||
makeFormsAjax: function () {
|
makeFormsAjax: function () {
|
||||||
var options = {
|
var options = {
|
||||||
success:this.reLoadView.bind(this),
|
success:this.onAttackExecution.bind(this),
|
||||||
url: this.model.urlRoot,
|
url: this.model.urlRoot,
|
||||||
type:'GET'
|
type:'GET'
|
||||||
// $.ajax options can be used here too, for example:
|
// $.ajax options can be used here too, for example:
|
||||||
//timeout: 3000
|
//timeout: 3000
|
||||||
};
|
};
|
||||||
//hook forms //TODO: clarify form selectors later
|
//hook forms //TODO: clarify form selectors later
|
||||||
$("form").ajaxForm(options);
|
$("form.attack").ajaxForm(options);
|
||||||
},
|
},
|
||||||
|
|
||||||
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs
|
ajaxifyAttackHref: function() { // rewrite any links with hrefs point to relative attack URLs
|
||||||
@ -54,10 +54,15 @@ define(['jquery',
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
reLoadView: function(content) {
|
onAttackExecution: function(feedback) {
|
||||||
this.model.setContent(content);
|
console.log('attack executed')
|
||||||
this.render();
|
this.renderFeedback(feedback);
|
||||||
|
},
|
||||||
|
|
||||||
|
renderFeedback: function(feedback) {
|
||||||
|
this.$el.find('feedback').html(feedback);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user