mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
Disable button when perform ajax post
This commit is contained in:
@@ -26,6 +26,8 @@ $('.reply').click(function() {
|
|||||||
}
|
}
|
||||||
msg_bd.find('.reply-at').click(replyatHandler);
|
msg_bd.find('.reply-at').click(replyatHandler);
|
||||||
msg_bd.find('.submit').click(function() {
|
msg_bd.find('.submit').click(function() {
|
||||||
|
var self = $(this);
|
||||||
|
self.attr('disabled', 'disabled');
|
||||||
var reply = $.trim(reply_input.val());
|
var reply = $.trim(reply_input.val());
|
||||||
if (reply && reply.length <= 150) {
|
if (reply && reply.length <= 150) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
@@ -42,10 +44,12 @@ $('.reply').click(function() {
|
|||||||
error.attr('class', 'error hide');
|
error.attr('class', 'error hide');
|
||||||
reply_cnt.html((parseInt(reply_cnt.html()) + 1 || 1) + ' ');
|
reply_cnt.html((parseInt(reply_cnt.html()) + 1 || 1) + ' ');
|
||||||
msg_bd.find('.reply-at').click(replyatHandler);
|
msg_bd.find('.reply-at').click(replyatHandler);
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
error.removeClass('hide');
|
error.removeClass('hide');
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -79,6 +79,9 @@ button:hover {
|
|||||||
cursor:pointer;
|
cursor:pointer;
|
||||||
background: #FFF;
|
background: #FFF;
|
||||||
}
|
}
|
||||||
|
input[type=submit][disabled=disabled]{
|
||||||
|
background: #ebebe4;
|
||||||
|
}
|
||||||
input[type="file"] {
|
input[type="file"] {
|
||||||
border:none;
|
border:none;
|
||||||
height:24px;
|
height:24px;
|
||||||
|
@@ -412,6 +412,9 @@ $('#mv-form h4').click(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$('#rename-form .submit').click(function() {
|
$('#rename-form .submit').click(function() {
|
||||||
|
var self = $(this);
|
||||||
|
self.attr('disabled', 'disabled');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url 'views.repo_rename_file' %}',
|
url: '{% url 'views.repo_rename_file' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -429,6 +432,7 @@ $('#rename-form .submit').click(function() {
|
|||||||
location.reload(true);
|
location.reload(true);
|
||||||
} else {
|
} else {
|
||||||
apply_form_error('rename-form', data['error']);
|
apply_form_error('rename-form', data['error']);
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data, textStatus, jqXHR) {
|
error: function(data, textStatus, jqXHR) {
|
||||||
@@ -436,12 +440,15 @@ $('#rename-form .submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('rename-form', value[0]);
|
apply_form_error('rename-form', value[0]);
|
||||||
});
|
});
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#add-new-file-form .submit').click(function() {
|
$('#add-new-file-form .submit').click(function() {
|
||||||
|
var self = $(this);
|
||||||
|
self.attr('disabled', 'disabled');
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url 'views.repo_new_file' %}',
|
url: '{% url 'views.repo_new_file' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -458,6 +465,7 @@ $('#add-new-file-form .submit').click(function() {
|
|||||||
location.reload(true);
|
location.reload(true);
|
||||||
} else {
|
} else {
|
||||||
apply_form_error('add-new-file-form', data['error']);
|
apply_form_error('add-new-file-form', data['error']);
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data, textStatus, jqXHR) {
|
error: function(data, textStatus, jqXHR) {
|
||||||
@@ -465,12 +473,16 @@ $('#add-new-file-form .submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('add-new-file-form', value[0]);
|
apply_form_error('add-new-file-form', value[0]);
|
||||||
});
|
});
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#add-new-dir-form .submit').click(function() {
|
$('#add-new-dir-form .submit').click(function() {
|
||||||
|
var self = $(this);
|
||||||
|
self.attr('disabled', 'disabled');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{% url 'views.repo_new_dir' %}',
|
url: '{% url 'views.repo_new_dir' %}',
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
@@ -487,6 +499,7 @@ $('#add-new-dir-form .submit').click(function() {
|
|||||||
location.reload(true);
|
location.reload(true);
|
||||||
} else {
|
} else {
|
||||||
apply_form_error('add-new-dir-form', data['error']);
|
apply_form_error('add-new-dir-form', data['error']);
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data, textStatus, jqXHR) {
|
error: function(data, textStatus, jqXHR) {
|
||||||
@@ -494,6 +507,7 @@ $('#add-new-dir-form .submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('add-new-dir-form', value[0]);
|
apply_form_error('add-new-dir-form', value[0]);
|
||||||
});
|
});
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return false;
|
return false;
|
||||||
|
@@ -19,5 +19,5 @@
|
|||||||
<input type="password" name="passwd_again" disabled="disabled" class="passwd input-disabled" />
|
<input type="password" name="passwd_again" disabled="disabled" class="passwd input-disabled" />
|
||||||
</div>
|
</div>
|
||||||
<p class="error hide"></p>
|
<p class="error hide"></p>
|
||||||
<input type="submit" id="repo-create-submit" value="提交" class="submit" />
|
<input type="submit" id="repo-create-submit" value="提交" class="submit"/>
|
||||||
</form>
|
</form>
|
||||||
|
@@ -21,6 +21,8 @@ $('#encrypt-switch').click(function () {
|
|||||||
$('#repo-create-submit').click(function() {
|
$('#repo-create-submit').click(function() {
|
||||||
var passwd = $('#repo-create-form input[name="passwd"]'),
|
var passwd = $('#repo-create-form input[name="passwd"]'),
|
||||||
passwd_again = $('#repo-create-form input[name="passwd_again"]');
|
passwd_again = $('#repo-create-form input[name="passwd_again"]');
|
||||||
|
var self = $(this);
|
||||||
|
self.attr('disabled', 'disabled');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '{{ post_url }}',
|
url: '{{ post_url }}',
|
||||||
@@ -43,6 +45,7 @@ $('#repo-create-submit').click(function() {
|
|||||||
location.reload(true);
|
location.reload(true);
|
||||||
} else {
|
} else {
|
||||||
apply_form_error('repo-create-form', data['error']);
|
apply_form_error('repo-create-form', data['error']);
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
error: function(data, textStatus, jqXHR) {
|
error: function(data, textStatus, jqXHR) {
|
||||||
@@ -50,6 +53,7 @@ $('#repo-create-submit').click(function() {
|
|||||||
$.each(errors, function(index, value) {
|
$.each(errors, function(index, value) {
|
||||||
apply_form_error('repo-create-form', value[0]);
|
apply_form_error('repo-create-form', value[0]);
|
||||||
});
|
});
|
||||||
|
self.removeAttr('disabled');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user