1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-15 23:00:57 +00:00

[misc] fix

This commit is contained in:
llj
2016-07-20 14:20:19 +08:00
parent 603f88c6ab
commit 2f5cf202d9
8 changed files with 20 additions and 12 deletions

View File

@@ -105,10 +105,16 @@ define([
var _this = this;
$form.submit(function() {
var group_name = $.trim($('[name="group_name"]', $form).val());
var $error = $('.error', $form);
var $submitBtn = $('[type="submit"]', $form);
if (!group_name) {
$error.html(gettext("It is required.")).show();
return false;
}
Common.disableButton($('[type="submit"]', $form));
$error.hide();
Common.disableButton($submitBtn);
groups.create({'name': group_name, 'repos':[]}, {
wait: true,
validate: true,
@@ -118,6 +124,7 @@ define([
_this.reset();
}
app.ui.sideNavView.updateGroups();
Common.closeModal();
},
error: function(collection, response, options) {
var err_msg;
@@ -126,10 +133,8 @@ define([
} else {
err_msg = gettext('Please check the network.');
}
Common.feedback(err_msg, 'error', Common.ERROR_TIMEOUT);
},
complete: function() {
Common.closeModal();
$error.html(err_msg).show();
Common.enableButton($submitBtn);
}
});

View File

@@ -44,12 +44,15 @@ define([
$num.addClass('hide');
document.title = _this.orig_doc_title;
}
},
error: function() { // e.g. 401 UNAUTHORIZED
clearInterval(reqInterval); // stop sending requests
}
});
};
reqUnreadNum();
// request every 30s
setInterval(reqUnreadNum, 30*1000);
var reqInterval = setInterval(reqUnreadNum, 30*1000);
$('#notice-icon').click(function() {
_this.toggle();