aboutsummaryrefslogtreecommitdiff
path: root/include/assignments-overview.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/assignments-overview.php')
-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('');
}
}