mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 03:26:06 +01:00
Disable submit buttons while performing validation
This commit is contained in:
@@ -11,11 +11,13 @@
|
||||
<script>
|
||||
$(function(){
|
||||
var callback = function(data){
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').removeAttr('disabled');
|
||||
$('#commentContent-@commentId').empty().html(data.content);
|
||||
prettyPrint();
|
||||
};
|
||||
|
||||
$('#update-comment-@commentId').click(function(){
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
|
||||
$.ajax({
|
||||
url: '@path/@owner/@repository/issue_comments/edit/@commentId',
|
||||
type: 'POST',
|
||||
@@ -26,11 +28,13 @@ $(function(){
|
||||
}).done(
|
||||
callback
|
||||
).fail(function(req) {
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').removeAttr('disabled');
|
||||
$('#error-edit-content-@commentId').text($.parseJSON(req.responseText).content);
|
||||
});
|
||||
});
|
||||
|
||||
$('#cancel-comment-@commentId').click(function(){
|
||||
$('#update-comment-@commentId, #cancel-comment-@commentId').attr('disabled', 'disabled');
|
||||
$.get('@path/@owner/@repository/issue_comments/_data/@commentId', callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
@@ -14,11 +14,13 @@ $(function(){
|
||||
$('#edit-content').elastic();
|
||||
|
||||
var callback = function(data){
|
||||
$('#update, #cancel').removeAttr('disabled');
|
||||
$('#issueTitle').empty().text(data.title);
|
||||
$('#issueContent').empty().html(data.content);
|
||||
};
|
||||
|
||||
$('#update').click(function(){
|
||||
$('#update, #cancel').attr('disabled', 'disabled');
|
||||
$.ajax({
|
||||
url: '@path/@owner/@repository/issues/edit/@issueId',
|
||||
type: 'POST',
|
||||
@@ -29,11 +31,13 @@ $(function(){
|
||||
}).done(
|
||||
callback
|
||||
).fail(function(req) {
|
||||
$('#update, #cancel').removeAttr('disabled');
|
||||
$('#error-edit-title').text($.parseJSON(req.responseText).title);
|
||||
});
|
||||
});
|
||||
|
||||
$('#cancel').click(function(){
|
||||
$('#update, #cancel').attr('disabled', 'disabled');
|
||||
$.get('@path/@owner/@repository/issues/_data/@issueId', callback);
|
||||
return false;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user