aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCamil Staps2015-02-11 21:37:05 +0100
committerCamil Staps2015-02-11 21:37:05 +0100
commit2f2708d2622cd8ca797cc5a9cecbf8bd9a6a03ef (patch)
tree5c7677a73df44598c3e461a7b69510e4da17aedd /include
parentcontacts can now be added without reloading the page (diff)
assignments can now be added without reloading the page
Diffstat (limited to 'include')
-rw-r--r--include/assignments-overview.php28
1 files changed, 10 insertions, 18 deletions
diff --git a/include/assignments-overview.php b/include/assignments-overview.php
index afb4389..2881987 100644
--- a/include/assignments-overview.php
+++ b/include/assignments-overview.php
@@ -73,7 +73,7 @@
<div class="panel-heading">Create new</div>
<div class="panel-body">
<form role="form" id="newAssignment" action='<?=constants::url_external?>assignments/new' method="post" class="bootstrapValidator ajaxify"
- data-ajaxify-options='{"success":"newAssignmentSuccess","error":"newAssignmentError","beforeSubmit":"newAssignmentBeforeSubmit","clearForm":true}'>
+ data-ajaxify-options='{"success":"newAssignmentSuccess","error":"newAssignmentError","beforeSubmit":"newAssignmentBeforeSubmit"}'>
<div class="ajaxify-response alert alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button><span class="ajaxify-response-text"></span></div>
<div class="col-lg-6">
<div class="form-group">
@@ -136,24 +136,16 @@
// Callback for when the form is successfully submitted
function newAssignmentSuccess(data) {
- if (data.success == true) {
- $('#newAssignment .ajaxify-response')
- .addClass('alert-success')
- .show()
- .find('.ajaxify-response-text')
- .html(data.message);
-
- $('#newAssignment input, #newAssignment button').prop('disabled', false);
- $('#newAssignment').data('bootstrapValidator').resetForm();
- } else {
- $('#newAssignment .ajaxify-response')
- .addClass('alert-danger')
- .show()
- .find('.ajaxify-response-text')
- .html(data.message);
+ $('#newAssignment .ajaxify-response')
+ .addClass(data.success ? 'alert-success' : 'alert-danger')
+ .show()
+ .find('.ajaxify-response-text')
+ .html(data.message);
- $('#newAssignment input, #newAssignment button').prop('disabled', false);
- $('#newAssignment').data('bootstrapValidator').resetForm();
+ $('#newAssignment input, #newAssignment button').prop('disabled', false);
+ $('#newAssignment').data('bootstrapValidator').resetForm();
+ if (data.success) {
+ $('#newAssignment input, #newAssignment textarea').val('');
}
}