[IMP] Added modal when AJAX submission fails

.. note:: 
    modal is rendered by QWeb so translation should be OK

bzr revid: rim@openerp.com-20131209130326-4ib589zrzsoz4qlm
This commit is contained in:
Richard Mathot (OpenERP) 2013-12-09 14:03:26 +01:00
parent 2aa63b3429
commit 2fccf08c32
2 changed files with 16 additions and 2 deletions

View File

@ -94,7 +94,7 @@ $(document).ready(function () {
},
timeout: 5000,
error: function(jqXHR, textStatus, errorThrown){ // failure of AJAX request
alert("Something went wrong while contacting survey server. Your answers have probably not been recorded. Try refreshing.\n" + errorThrown);
$('#AJAXErrorModal').modal('show');
}
});
@ -105,5 +105,4 @@ $(document).ready(function () {
});
console.debug("[survey] Custom JS for survey loaded!");
});

View File

@ -120,6 +120,21 @@
<button type="submit" t-if="last" class="btn btn-primary">Submit survey</button>
</div>
</form>
<!-- Modal used to display error message, i.c.o. ajax error -->
<div class="modal fade" id="AJAXErrorModal" role="dialog" aria-labelledby="AJAXErrorModal" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&amp;times;</button>
<h4 class="modal-title">A problem has occured</h4>
</div>
<div class="modal-body"><p>Something went wrong while contacting survey server. <strong class="text-danger">Your answers have probably not been recorded.</strong> Try refreshing.</p></div>
<div class="modal-footer"><button type="button" class="btn btn-primary" data-dismiss="modal">Close</button></div>
</div>
</div>
</div>
</template>
<!-- Question widgets -->