initial support for separation of content from attack in UI
This commit is contained in:
@ -29,8 +29,8 @@ function($,_,Backbone) {
|
||||
if (this.hasSolution) {
|
||||
this.$el.find('#show-solution-button').unbind().on('click',_.bind(this.showSolution,this)).show();
|
||||
}
|
||||
if (this.hasPlan) {
|
||||
this.$el.find('#show-plan-button').unbind().on('click',_.bind(this.showPlan,this)).show();
|
||||
if (true) { //FIXME: change to this.hasAttack
|
||||
this.$el.find('#show-attack-button').unbind().on('click',_.bind(this.showAttack,this)).show();
|
||||
}
|
||||
if (this.hasHints) {
|
||||
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');
|
||||
},
|
||||
|
||||
showPlan: function() {
|
||||
this.trigger('plan:show','plan');
|
||||
showAttack: function() {
|
||||
this.trigger('attack:show',{show:true});
|
||||
},
|
||||
|
||||
showHints: function() {
|
||||
|
@ -25,14 +25,14 @@ define(['jquery',
|
||||
//TODO: reimplement this in custom fashion maybe?
|
||||
makeFormsAjax: function () {
|
||||
var options = {
|
||||
success:this.reLoadView.bind(this),
|
||||
success:this.onAttackExecution.bind(this),
|
||||
url: this.model.urlRoot,
|
||||
type:'GET'
|
||||
// $.ajax options can be used here too, for example:
|
||||
//timeout: 3000
|
||||
};
|
||||
//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
|
||||
@ -54,10 +54,15 @@ define(['jquery',
|
||||
});
|
||||
},
|
||||
|
||||
reLoadView: function(content) {
|
||||
this.model.setContent(content);
|
||||
this.render();
|
||||
onAttackExecution: function(feedback) {
|
||||
console.log('attack executed')
|
||||
this.renderFeedback(feedback);
|
||||
},
|
||||
|
||||
renderFeedback: function(feedback) {
|
||||
this.$el.find('feedback').html(feedback);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user