Added client-side validation + not ignore error messages from the api
This commit is contained in:
parent
93b71d8d9b
commit
b05b42314a
|
|
@ -2255,10 +2255,17 @@ function setDeadline() {
|
|||
}
|
||||
|
||||
function updateDeadline(deadlineString) {
|
||||
$('#deadline-err-invalid-date').hide();
|
||||
$('#deadline-loader').addClass('loading');
|
||||
|
||||
var realDeadline = null;
|
||||
if (deadlineString !== '') {
|
||||
var dateToMatch = /([0-9]){4}-([0-9]){2}-([0-9]){2}\b/
|
||||
if (!dateToMatch.test(deadlineString)) {
|
||||
$('#deadline-loader').removeClass('loading');
|
||||
$('#deadline-err-invalid-date').show();
|
||||
return false;
|
||||
}
|
||||
realDeadline = deadlineString + 'T13:55:29.764Z';
|
||||
}
|
||||
|
||||
|
|
@ -2268,8 +2275,12 @@ function updateDeadline(deadlineString) {
|
|||
}),
|
||||
contentType: 'application/json',
|
||||
type: 'POST',
|
||||
complete: function () {
|
||||
success: function () {
|
||||
window.location.reload();
|
||||
},
|
||||
error: function () {
|
||||
$('#deadline-loader').removeClass('loading');
|
||||
$('#deadline-err-invalid-date').show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -212,6 +212,10 @@
|
|||
<div class="ui divider"></div>
|
||||
<span class="text"><strong>{{.i18n.Tr "repo.issues.due_date"}}</strong></span>
|
||||
<div class="ui form" id="deadline-loader">
|
||||
<div class="ui negative message" id="deadline-err-invalid-date" style="display: none;">
|
||||
<i class="close icon"></i>
|
||||
The due date is invalid or out of range. Please use yyyy-mm-dd.
|
||||
</div>
|
||||
{{if gt .Issue.DeadlineUnix 0}}
|
||||
<p>
|
||||
<span class="octicon octicon-calendar"></span>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user