issues counter are now live updated on creation/deleteion/reopening …

buttons on forms are disabled on submit (re-enabled after the request is complete)
This commit is contained in:
Staicu Ionut 2012-07-10 07:33:04 +03:00
parent be1b40802d
commit ba7b85d0d9
7 changed files with 48 additions and 11 deletions

View file

@ -73,4 +73,25 @@ function issuesPage(){
$("#milestone_id, #assignee_id, #label_name").on("change", function(){
$(this).closest("form").submit();
});
$('body').on('ajax:success', '.close_issue, .reopen_issue, #new_issue', function(){
var t = $(this),
totalIssues,
reopen = t.hasClass('reopen_issue'),
newIssue = false;
if( this.id == 'new_issue' ){
newIssue = true;
}
$('.issue_counter, #new_issue').each(function(){
var issue = $(this);
totalIssues = parseInt( $(this).html(), 10 );
if( newIssue || ( reopen && issue.closest('.main_menu').length ) ){
$(this).html( totalIssues+1 );
}else {
$(this).html( totalIssues-1 );
}
});
});
}