From a7d3e2b9b6a015e0e4a4e3b84439308bb6fe367a Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 15 Nov 2013 09:18:06 +0200 Subject: [PATCH] Fix recent branches order. Added counters --- app/models/repository.rb | 2 +- app/views/projects/branches/_filter.html.haml | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/models/repository.rb b/app/models/repository.rb index 80918d6..5813070 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -57,7 +57,7 @@ class Repository def recent_branches(limit = 20) branches.sort do |a, b| - a.commit.committed_date <=> b.commit.committed_date + b.commit.committed_date <=> a.commit.committed_date end[0..limit] end diff --git a/app/views/projects/branches/_filter.html.haml b/app/views/projects/branches/_filter.html.haml index 7ea11a7..7e14782 100644 --- a/app/views/projects/branches/_filter.html.haml +++ b/app/views/projects/branches/_filter.html.haml @@ -1,12 +1,22 @@ %ul.nav.nav-pills.nav-stacked = nav_link(path: 'branches#recent') do - = link_to 'Recent', recent_project_branches_path(@project) + = link_to recent_project_branches_path(@project) do + Recent + .pull-right + = @repository.recent_branches.count + = nav_link(path: 'protected_branches#index') do = link_to project_protected_branches_path(@project) do Protected %i.icon-lock + .pull-right + = @project.protected_branches.count + = nav_link(path: 'branches#index') do - = link_to 'All branches', project_branches_path(@project) + = link_to project_branches_path(@project) do + All branches + .pull-right + = @repository.branch_names.count %hr -- libgit2 0.21.2