From 63fe042d97a5430770ec50fc0e8f29c416bd2ec9 Mon Sep 17 00:00:00 2001 From: randx Date: Tue, 9 Oct 2012 20:39:06 +0300 Subject: [PATCH] project.issues_labels method --- app/controllers/labels_controller.rb | 2 +- app/models/project.rb | 4 ++++ app/roles/issue_commonality.rb | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/controllers/labels_controller.rb b/app/controllers/labels_controller.rb index 3cbbb86..999351e 100644 --- a/app/controllers/labels_controller.rb +++ b/app/controllers/labels_controller.rb @@ -7,7 +7,7 @@ class LabelsController < ProjectResourceController respond_to :js, :html def index - @labels = @project.issues.tag_counts_on(:labels).order('count DESC') + @labels = @project.issues_labels.order('count DESC') end protected diff --git a/app/models/project.rb b/app/models/project.rb index f4d8688..3ae15f2 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -159,6 +159,10 @@ class Project < ActiveRecord::Base def project_id self.id end + + def issues_labels + issues.tag_counts_on(:labels) + end end # == Schema Information diff --git a/app/roles/issue_commonality.rb b/app/roles/issue_commonality.rb index b21d92a..4aee916 100644 --- a/app/roles/issue_commonality.rb +++ b/app/roles/issue_commonality.rb @@ -1,4 +1,5 @@ -# Contains common functionality shared between Issues and MergeRequests +# Contains common functionality +# shared between Issues and MergeRequests module IssueCommonality extend ActiveSupport::Concern -- libgit2 0.21.2