diff options
author | Jan Provaznik <jprovaznik@gitlab.com> | 2019-04-23 19:58:20 +0000 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2019-04-23 19:58:20 +0000 |
commit | 8ce4b6093a2e64f21928dded6c58950f180d8c2a (patch) | |
tree | e3478cf58d2119fd2f84572d34acf0c507e75a5b /app/models/global_label.rb | |
parent | be15592a1c1551bb6136081ea995dca49e238c8f (diff) | |
download | gitlab-ce-8ce4b6093a2e64f21928dded6c58950f180d8c2a.tar.gz |
Move scoped_label into label presenter
When rendering a label we want to check 'scoped_label' feature
availability on a project/group where label is being used. For
this reason a label presenter is used in UI and information about
context project/group is passed to this presenter.
Diffstat (limited to 'app/models/global_label.rb')
-rw-r--r-- | app/models/global_label.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/global_label.rb b/app/models/global_label.rb index 572cb12b26a..7c020dd3b3d 100644 --- a/app/models/global_label.rb +++ b/app/models/global_label.rb @@ -1,6 +1,8 @@ # frozen_string_literal: true class GlobalLabel + include Presentable + attr_accessor :title, :labels alias_attribute :name, :title @@ -23,4 +25,8 @@ class GlobalLabel @labels = labels @first_label = labels.find { |lbl| lbl.description.present? } || labels.first end + + def present(attributes) + super(attributes.merge(presenter_class: ::LabelPresenter)) + end end |