Merge pull request #1064 from iamntz/menus_updater
Live issues counter updates
This commit is contained in:
commit
6ca921ae85
7 changed files with 48 additions and 11 deletions
|
@ -20,10 +20,26 @@
|
||||||
//= require_tree .
|
//= require_tree .
|
||||||
|
|
||||||
$(document).ready(function(){
|
$(document).ready(function(){
|
||||||
|
|
||||||
$(".one_click_select").live("click", function(){
|
$(".one_click_select").live("click", function(){
|
||||||
$(this).select();
|
$(this).select();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('body').on('ajax:complete, ajax:beforeSend, submit', 'form', function(e){
|
||||||
|
var buttons = $('[type="submit"]', this);
|
||||||
|
switch( e.type ){
|
||||||
|
case 'ajax:beforeSend':
|
||||||
|
case 'submit':
|
||||||
|
buttons.attr('disabled', 'disabled');
|
||||||
|
break;
|
||||||
|
case ' ajax:complete':
|
||||||
|
default:
|
||||||
|
buttons.removeAttr('disabled');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
$(".account-box").mouseenter(showMenu);
|
$(".account-box").mouseenter(showMenu);
|
||||||
$(".account-box").mouseleave(resetMenu);
|
$(".account-box").mouseleave(resetMenu);
|
||||||
|
|
||||||
|
|
|
@ -73,4 +73,25 @@ function issuesPage(){
|
||||||
$("#milestone_id, #assignee_id, #label_name").on("change", function(){
|
$("#milestone_id, #assignee_id, #label_name").on("change", function(){
|
||||||
$(this).closest("form").submit();
|
$(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 );
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -695,4 +695,4 @@ li.note {
|
||||||
border:1px solid #B8B;
|
border:1px solid #B8B;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,9 @@
|
||||||
.row
|
.row
|
||||||
.span7= paginate @issues, :remote => true, :theme => "gitlab"
|
.span7= paginate @issues, :remote => true, :theme => "gitlab"
|
||||||
.span3.right
|
.span3.right
|
||||||
%span.cgray.right #{@issues.total_count} issues for this filter
|
%span.cgray.right
|
||||||
|
%span.issue_counter #{@issues.total_count}
|
||||||
|
issues for this filter
|
||||||
- else
|
- else
|
||||||
%li
|
%li
|
||||||
%h4.nothing_here_message Nothing to show here
|
%h4.nothing_here_message Nothing to show here
|
||||||
|
|
|
@ -12,9 +12,9 @@
|
||||||
= issue.notes.count
|
= issue.notes.count
|
||||||
- if can? current_user, :modify_issue, issue
|
- if can? current_user, :modify_issue, issue
|
||||||
- if issue.closed
|
- if issue.closed
|
||||||
= link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small grouped", :remote => true
|
= link_to 'Reopen', project_issue_path(issue.project, issue, :issue => {:closed => false }, :status_only => true), :method => :put, :class => "btn small grouped reopen_issue", :remote => true
|
||||||
- else
|
- else
|
||||||
= link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small grouped", :remote => true
|
= link_to 'Resolve', project_issue_path(issue.project, issue, :issue => {:closed => true }, :status_only => true), :method => :put, :class => "success btn small grouped close_issue", :remote => true
|
||||||
= link_to edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true do
|
= link_to edit_project_issue_path(issue.project, issue), :class => "btn small edit-issue-link", :remote => true do
|
||||||
%i.icon-edit
|
%i.icon-edit
|
||||||
Edit
|
Edit
|
||||||
|
@ -35,6 +35,4 @@
|
||||||
|
|
||||||
|
|
||||||
- if issue.upvotes > 0
|
- if issue.upvotes > 0
|
||||||
%span.badge.badge-success= "+#{issue.upvotes}"
|
%span.badge.badge-success= "+#{issue.upvotes}"
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
.issues_content
|
.issues_content
|
||||||
%h3.page_title
|
%h3.page_title
|
||||||
Issues
|
Issues
|
||||||
%small (#{@issues.total_count})
|
%small (<span class=issue_counter>#{@issues.total_count}</span>)
|
||||||
.right
|
.right
|
||||||
.span5
|
.span5
|
||||||
- if can? current_user, :write_issue, @project
|
- if can? current_user, :write_issue, @project
|
||||||
|
@ -45,4 +45,4 @@
|
||||||
:javascript
|
:javascript
|
||||||
$(function(){
|
$(function(){
|
||||||
issuesPage();
|
issuesPage();
|
||||||
})
|
})
|
|
@ -17,14 +17,14 @@
|
||||||
%li{:class => tab_class(:issues)}
|
%li{:class => tab_class(:issues)}
|
||||||
= link_to project_issues_filter_path(@project) do
|
= link_to project_issues_filter_path(@project) do
|
||||||
Issues
|
Issues
|
||||||
%span.count= @project.issues.opened.count
|
%span.count.issue_counter= @project.issues.opened.count
|
||||||
|
|
||||||
- if @project.repo_exists?
|
- if @project.repo_exists?
|
||||||
- if @project.merge_requests_enabled
|
- if @project.merge_requests_enabled
|
||||||
%li{:class => tab_class(:merge_requests)}
|
%li{:class => tab_class(:merge_requests)}
|
||||||
= link_to project_merge_requests_path(@project) do
|
= link_to project_merge_requests_path(@project) do
|
||||||
Merge Requests
|
Merge Requests
|
||||||
%span.count= @project.merge_requests.opened.count
|
%span.count.merge_counter= @project.merge_requests.opened.count
|
||||||
|
|
||||||
- if @project.wall_enabled
|
- if @project.wall_enabled
|
||||||
%li{:class => tab_class(:wall)}
|
%li{:class => tab_class(:wall)}
|
||||||
|
|
Loading…
Add table
Reference in a new issue