paging mod, binding actions/callback per form within lesson
This commit is contained in:
parent
1fff86fa2d
commit
95526b5100
@ -23,17 +23,18 @@ define(['jquery',
|
|||||||
this.initPagination();
|
this.initPagination();
|
||||||
},
|
},
|
||||||
|
|
||||||
//TODO: reimplement this in custom fashion maybe?
|
|
||||||
makeFormsAjax: function () {
|
makeFormsAjax: function () {
|
||||||
var options = {
|
// will bind all forms with attack-form class
|
||||||
success:this.onAttackExecution.bind(this),
|
var self = this;
|
||||||
url: this.model.urlRoot,
|
$("form.attack-form").each(function(form) {
|
||||||
type:'GET'
|
var options = {
|
||||||
// $.ajax options can be used here too, for example:
|
success:self.onAttackExecution.bind(this),
|
||||||
//timeout: 3000
|
url: this.action,
|
||||||
};
|
type:this.method,
|
||||||
//hook forms //TODO: clarify form selectors later
|
// additional options
|
||||||
$("form.attack-form").ajaxForm(options);
|
};
|
||||||
|
$(this).ajaxForm(options);
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
initPagination: function() {
|
initPagination: function() {
|
||||||
@ -56,7 +57,7 @@ define(['jquery',
|
|||||||
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
|
// Besides, the new MVC code registers an event handler that will reload the lesson according to the route.
|
||||||
$('form').submit(function(event){
|
$('form').submit(function(event){
|
||||||
$.get(this.action, "json")
|
$.get(this.action, "json")
|
||||||
.done(self.reLoadView.bind(self))
|
//.done(self.reLoadView.bind(self))
|
||||||
.fail(function() { alert("failed to GET " + url); });
|
.fail(function() { alert("failed to GET " + url); });
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
@ -111,11 +112,7 @@ define(['jquery',
|
|||||||
|
|
||||||
showCurContentPage: function(isIncrement) {
|
showCurContentPage: function(isIncrement) {
|
||||||
this.$contentPages.hide();
|
this.$contentPages.hide();
|
||||||
if (isIncrement) {
|
this.$el.find(this.$contentPages[this.currentPage]).show();
|
||||||
this.$el.find(this.$contentPages[this.currentPage]).slideDown(300);
|
|
||||||
} else {
|
|
||||||
this.$el.find(this.$contentPages[this.currentPage]).slideUp(300);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
hideNextPageButton: function() {
|
hideNextPageButton: function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user