Move sidebar build class into helper

This commit is contained in:
Annabel Dunstone Gray 2016-10-13 14:59:23 -05:00
parent 87222e27e3
commit 0bd525005b
3 changed files with 10 additions and 3 deletions

View file

@ -0,0 +1,7 @@
module BuildsHelper
def sidebar_build_class(build, current_build)
build_class = ''
build_class += ' active' if build == current_build
build_class += ' retried' if build.retried?
end
end

View file

@ -126,7 +126,7 @@
.builds-container
- statuses.each do |build_status|
- builds.select{|build| build.status == build_status}.each do |build|
.build-job{class: ('active' if build == @build; 'retried' if build.retried?), data: {stage: build.stage}}
.build-job{class: sidebar_build_class(build, @build), data: {stage: build.stage}}
= link_to namespace_project_build_path(@project.namespace, @project, build) do
= icon('arrow-right')
= ci_icon_for_status(build.status)
@ -136,4 +136,4 @@
- else
= build.id
- if build.retried?
%i.fa.fa-refresh.has-tooltip{data: { container: 'body', placement: 'bottom' }, title: 'This build was retried'}
%i.fa.fa-refresh.has-tooltip{data: { container: 'body', placement: 'bottom' }, title: 'Build was retried'}

View file

@ -37,7 +37,7 @@
= icon('warning', class: 'text-warning has-tooltip', title: 'Build is stuck. Check runners.')
- if defined?(retried) && retried
= icon('refresh', class: 'text-warning has-tooltip', title: 'Build was retried.')
= icon('refresh', class: 'text-warning has-tooltip', title: 'Build was retried')
.label-container
- if build.tags.any?