mirror of
https://github.com/fergalmoran/robotopro.git
synced 2025-12-22 09:18:53 +00:00
43 lines
1.8 KiB
HTML
Executable File
43 lines
1.8 KiB
HTML
Executable File
{% load static %}
|
|
<script src="{% static "js/uncompressed/fuelux/fuelux.wizard.js" %}"></script>
|
|
<script type="text/javascript">
|
|
$(function () {
|
|
var wizard = $('#promotion-wizard').ace_wizard();
|
|
wizard.on('change', function (e, info) {
|
|
if (info.step == 1) {
|
|
var detailsForm = $('#form_wizard_details');
|
|
detailsForm.ajaxSubmit({
|
|
success: function (e, val, errors) {
|
|
$('#id_pk').val(e.pk);
|
|
wizard.wizard('selectedItem', {step: 2});
|
|
},
|
|
error: function (response, status, err) {
|
|
$.each(response.responseJSON, function (item, error) {
|
|
$('#group-' + item).addClass('error');
|
|
$('#help-inline-' + item).text(error);
|
|
});
|
|
}
|
|
});
|
|
e.preventDefault();
|
|
} else if (info.step == 2) {
|
|
var bodyForm = $('#form_wizard_body');
|
|
bodyForm.ajaxSubmit({
|
|
success: function (e, val, errors) {
|
|
$('#id_pk').val(e.pk);
|
|
wizard.wizard('selectedItem', {step: 3});
|
|
},
|
|
error: function (e, val, errors) {
|
|
$.each(e.responseJSON, function (item, error) {
|
|
$('#group-' + item).addClass('error');
|
|
$('#help-inline-' + item).text(error);
|
|
});
|
|
}
|
|
});
|
|
e.preventDefault();
|
|
}
|
|
});
|
|
wizard.on('finished', function () {
|
|
alert('Success!');
|
|
});
|
|
});
|
|
</script> |