Class: LabelPresenter
Instance Method Summary
collapse
#initialize
#delegator_override, #delegator_override_with, #delegator_target, validator, validators, verify!
#__subject__, #can?, #declarative_policy_delegate, #is_a?, #path_with_line_numbers, #present, #url_builder, #web_path, #web_url
#can?
includes_helpers, redirect_legacy_paths, url_helpers
Instance Method Details
#can_subscribe_to_label_in_different_levels? ⇒ Boolean
45
46
47
|
# File 'app/presenters/label_presenter.rb', line 45
def can_subscribe_to_label_in_different_levels?
issuable_subject.is_a?(Project) && label.is_a?(GroupLabel)
end
|
#destroy_path ⇒ Object
19
20
21
22
23
24
25
|
# File 'app/presenters/label_presenter.rb', line 19
def destroy_path
case label
when GroupLabel then group_label_path(label.group, label)
when ProjectLabel then project_label_path(label.project, label)
else admin_label_path(label)
end
end
|
#edit_path ⇒ Object
7
8
9
10
11
12
13
|
# File 'app/presenters/label_presenter.rb', line 7
def edit_path
case label
when GroupLabel then edit_group_label_path(label.group, label)
when ProjectLabel then edit_project_label_path(label.project, label)
else edit_admin_label_path(label)
end
end
|
#filter_path(type: :issue) ⇒ Object
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'app/presenters/label_presenter.rb', line 27
def filter_path(type: :issue)
case context_subject
when Group
send( "#{type.to_s.pluralize}_group_path",
context_subject,
label_name: [label.name]
)
when Project
send( "namespace_project_#{type.to_s.pluralize}_path",
context_subject.namespace,
context_subject,
label_name: [label.name]
)
end
end
|
#label_subject ⇒ Object
53
54
55
|
# File 'app/presenters/label_presenter.rb', line 53
def label_subject
@label_subject ||= label.subject if label.respond_to?(:subject)
end
|
#project_label? ⇒ Boolean
49
50
51
|
# File 'app/presenters/label_presenter.rb', line 49
def project_label?
label.is_a?(ProjectLabel)
end
|
#text_color_class ⇒ Object
15
16
17
|
# File 'app/presenters/label_presenter.rb', line 15
def text_color_class
"gl-label-text-#{label.color.contrast.luminosity}"
end
|