OSDN Git Service

Fix recent branches order. Added counters
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 15 Nov 2013 07:18:06 +0000 (09:18 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Fri, 15 Nov 2013 07:18:06 +0000 (09:18 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/models/repository.rb
app/views/projects/branches/_filter.html.haml

index 80918d6..5813070 100644 (file)
@@ -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
 
index 7ea11a7..7e14782 100644 (file)
@@ -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