summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-10-09 20:39:06 +0300
committerrandx <dmitriy.zaporozhets@gmail.com>2012-10-09 20:39:06 +0300
commit63fe042d97a5430770ec50fc0e8f29c416bd2ec9 (patch)
tree3a38a6ce5c6aa94ae6daf917f341dfa4ccd36b3a /app
parentfa325ce97796a1ae25d64a4ec63bdad6599e98d7 (diff)
downloadgitlab-ce-63fe042d97a5430770ec50fc0e8f29c416bd2ec9.tar.gz
project.issues_labels method
Diffstat (limited to 'app')
-rw-r--r--app/controllers/labels_controller.rb2
-rw-r--r--app/models/project.rb4
-rw-r--r--app/roles/issue_commonality.rb3
3 files changed, 7 insertions, 2 deletions
diff --git a/app/controllers/labels_controller.rb b/app/controllers/labels_controller.rb
index 3cbbb8692e0..999351e22df 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 f4d868874b9..3ae15f24b1f 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 b21d92a3083..4aee916c03c 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