2018-11-19 21:01:13 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
module Gitlab
|
2017-05-31 01:50:53 -04:00
|
|
|
module SlashCommands
|
2017-01-19 03:22:09 -05:00
|
|
|
module Presenters
|
2017-02-08 10:42:27 -05:00
|
|
|
module IssueBase
|
2017-01-19 03:22:09 -05:00
|
|
|
def color(issuable)
|
|
|
|
issuable.open? ? '#38ae67' : '#d22852'
|
|
|
|
end
|
2017-01-10 13:43:58 -05:00
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
def status_text(issuable)
|
|
|
|
issuable.open? ? 'Open' : 'Closed'
|
|
|
|
end
|
|
|
|
|
|
|
|
def project
|
2017-11-17 07:27:16 -05:00
|
|
|
resource.project
|
2017-01-19 03:22:09 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def author
|
2017-11-17 07:27:16 -05:00
|
|
|
resource.author
|
2017-01-19 03:22:09 -05:00
|
|
|
end
|
2017-01-10 13:43:58 -05:00
|
|
|
|
2017-01-19 03:22:09 -05:00
|
|
|
def fields
|
|
|
|
[
|
|
|
|
{
|
|
|
|
title: "Assignee",
|
2017-11-17 07:27:16 -05:00
|
|
|
value: resource.assignees.any? ? resource.assignees.first.name : "_None_",
|
2017-01-19 03:22:09 -05:00
|
|
|
short: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "Milestone",
|
2017-11-17 07:27:16 -05:00
|
|
|
value: resource.milestone ? resource.milestone.title : "_None_",
|
2017-01-19 03:22:09 -05:00
|
|
|
short: true
|
|
|
|
},
|
|
|
|
{
|
|
|
|
title: "Labels",
|
2017-11-17 07:27:16 -05:00
|
|
|
value: resource.labels.any? ? resource.label_names.join(', ') : "_None_",
|
2017-01-19 03:22:09 -05:00
|
|
|
short: true
|
|
|
|
}
|
|
|
|
]
|
|
|
|
end
|
2017-11-17 07:27:16 -05:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
attr_reader :resource
|
2017-01-19 03:22:09 -05:00
|
|
|
end
|
2017-01-10 13:43:58 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|