forked from zendesk/samson
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprojects_helper.rb
38 lines (35 loc) · 965 Bytes
/
projects_helper.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module ProjectsHelper
def star_for_project(project)
content_tag :span, class: 'star' do
if current_user.starred_project?(project)
path = star_path(id: project)
options = {
class: 'glyphicon glyphicon-star',
method: :delete,
title: 'Unstar this project'
}
else
path = stars_path(id: project)
options = {
class: 'glyphicon glyphicon-star-empty',
method: :post,
title: 'Star this project'
}
end
link_to '', path, options.merge(remote: true)
end
end
def deployment_alert_title(deploy)
failed_at = deploy.updated_at.strftime('%Y/%m/%d %H:%M:%S')
reference = deploy.short_reference
username = deploy.user.name
"#{failed_at} Last deployment failed! #{username} failed to deploy '#{reference}'"
end
def job_state_class(job)
if job.succeeded?
'success'
else
'failed'
end
end
end