This commit is contained in:
elclanrs 2013-11-15 18:08:32 -05:00
parent e3a0a98678
commit 7e0a6e2789
6 changed files with 79 additions and 73 deletions

View file

@ -20,7 +20,8 @@ module.exports = {
this._buildCustomInputs();
},
addFields: function() {
// @extend
'addFields:after': function() {
this._buildCustomInputs();
},

View file

@ -78,7 +78,7 @@ module.exports = {
field: template(self.opts.templates[field.type], field)
});
self._inject('addFields', field);
self._inject('addFields:before', field);
if (field.after || field.before) {
self.$form.find('[name="'+ (field.after || field.before) +'"]').first().each(function() {
@ -95,6 +95,8 @@ module.exports = {
rules[name] = field.rules;
self.addRules(rules);
}
self._inject('addFields:after', field);
});
},

View file

@ -62,6 +62,38 @@ module.exports = {
setTimeout(function(){ $(firstInvalid).focus() }, this.opts.steps.fadeSpeed);
},
// @extend
addRules: function() {
this.firstStep();
},
// @extend
'addFields:before': function(field) {
if (field.after || field.before) return;
var $steps = this.$stepsContainer.find(this.opts.steps.step);
if (! ('appendToStep' in field)) {
field.appendToStep = $steps.length-1;
}
field.after = $steps
.eq(field.appendToStep)
.find('input, select, textarea')
.last()[0].name;
},
// @extend
toggleFields: function() {
this._updateSteps();
},
// @extend
removeFields: function() {
this._updateSteps();
},
_buildSteps: function() {
var self = this, options
@ -97,38 +129,6 @@ module.exports = {
});
},
// @extend
addRules: function() {
this.firstStep();
},
// @extend
addFields: function(field) {
if (field.after || field.before) return;
var $steps = this.$stepsContainer.find(this.opts.steps.step);
if (! ('appendToStep' in field)) {
field.appendToStep = $steps.length-1;
}
field.after = $steps
.eq(field.appendToStep)
.find('input, select, textarea')
.last()[0].name;
},
// @extend
toggleFields: function() {
this._updateSteps();
},
// @extend
removeFields: function() {
this._updateSteps();
},
goToStep: function(idx) {
this.$stepsContainer.idealsteps('go', idx);
},

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -58,7 +58,7 @@ module.exports = (function() {
return;
}
if (Plugin.prototype[method]) {
; if (Plugin.prototype[method.split(':')[0]]) {
Plugin._extended[method] = Plugin._extended[method] || [];
Plugin._extended[method].push({ name: extension.name, fn: fn });
} else {