summaryrefslogtreecommitdiff
path: root/app/helpers/ci/builds_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/helpers/ci/builds_helper.rb')
-rw-r--r--app/helpers/ci/builds_helper.rb41
1 files changed, 41 insertions, 0 deletions
diff --git a/app/helpers/ci/builds_helper.rb b/app/helpers/ci/builds_helper.rb
new file mode 100644
index 00000000000..cdabdad17d2
--- /dev/null
+++ b/app/helpers/ci/builds_helper.rb
@@ -0,0 +1,41 @@
+module Ci
+ 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)
+ ci_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?
+ 'fa-circle cgreen'
+ elsif build.failed?
+ 'fa-circle cred'
+ else
+ 'fa-circle light'
+ end
+ end
+ end
+end