Module: Gitlab::SlashCommands::Presenters::IssueBase

Included in:
IssueClose, IssueMove, IssueNew, IssueSearch, IssueShow
Defined in:
lib/gitlab/slash_commands/presenters/issue_base.rb

Instance Method Summary collapse

Instance Method Details

#authorObject


19
20
21
# File 'lib/gitlab/slash_commands/presenters/issue_base.rb', line 19

def author
  resource.author
end

#color(issuable) ⇒ Object


7
8
9
# File 'lib/gitlab/slash_commands/presenters/issue_base.rb', line 7

def color(issuable)
  issuable.open? ? '#38ae67' : '#d22852'
end

#fieldsObject


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/gitlab/slash_commands/presenters/issue_base.rb', line 23

def fields
  [
    {
      title: "Assignee",
      value: resource.assignees.any? ? resource.assignees.first.name : "_None_",
      short: true
    },
    {
      title: "Milestone",
      value: resource.milestone ? resource.milestone.title : "_None_",
      short: true
    },
    {
      title: "Labels",
      value: resource.labels.any? ? resource.label_names.join(', ') : "_None_",
      short: true
    }
  ]
end

#projectObject


15
16
17
# File 'lib/gitlab/slash_commands/presenters/issue_base.rb', line 15

def project
  resource.project
end

#status_text(issuable) ⇒ Object


11
12
13
# File 'lib/gitlab/slash_commands/presenters/issue_base.rb', line 11

def status_text(issuable)
  issuable.open? ? 'Open' : 'Closed'
end