summaryrefslogtreecommitdiff
path: root/app/helpers/builds_helper.rb
blob: 6e63dc0001b19979271be0391dd28a7ea1861461 (plain)
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
39
module BuildsHelper
  def build_ref_link build
    gitlab_ref_link build.project, build.ref
  end

  def build_compare_link build
    gitlab_compare_link build.project, build.commit.short_before_sha, build.short_sha
  end

  def build_commit_link build
    gitlab_commit_link build.project, build.short_sha
  end

  def build_url(build)
    project_build_url(build.project, build)
  end

  def build_status_alert_class(build)
    if build.success?
      'alert-success'
    elsif build.failed?
      'alert-danger'
    elsif build.canceled?
      'alert-disabled'
    else
      'alert-warning'
    end
  end

  def build_icon_css_class(build)
    if build.success?
      'icon-circle cgreen'
    elsif build.failed?
      'icon-circle cred'
    else
      'icon-circle light'
    end
  end
end