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