diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-30 15:15:39 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-07-30 15:15:39 +0300 |
commit | 593df8e69a81a3ab0a4755db74dc282c00e02ef5 (patch) | |
tree | cdbec00afa3289a9fe4065a8c7ba56e5c82a365f /app/models/label.rb | |
parent | cc331684593143cba773b0160222865eeb86b134 (diff) | |
download | gitlab-ce-593df8e69a81a3ab0a4755db74dc282c00e02ef5.tar.gz |
Improve labels
* allow developers to manage labels
* add ability to remove label
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/label.rb')
-rw-r--r-- | app/models/label.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/label.rb b/app/models/label.rb index ea1daa6a204..5d6e5e91a0c 100644 --- a/app/models/label.rb +++ b/app/models/label.rb @@ -1,6 +1,7 @@ class Label < ActiveRecord::Base belongs_to :project has_many :label_links, dependent: :destroy + has_many :issues, through: :label_links, source: :target, source_type: 'Issue' validates :color, format: { with: /\A\#[0-9A-Fa-f]{6}+\Z/ }, allow_blank: true validates :project, presence: true @@ -11,4 +12,8 @@ class Label < ActiveRecord::Base def name title end + + def open_issues_count + issues.opened.count + end end |