Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added exit_code_ok? helper method to avoid nil errors in views.

  • Loading branch information...
commit 73076fa2081753062e1eb35d54f7faee2cb23e3e 1 parent 039f621
@benissimo authored
View
4 app/helpers/application_helper.rb
@@ -73,4 +73,8 @@ def status_css_class(status)
end
end
+ def exit_code_ok?(build_or_part)
+ build_or_part.output[0] && build_or_part.output[0].exit_code == 0
+ end
+
end
View
6 app/views/builds/_build.html.haml
@@ -1,12 +1,12 @@
.build-details
- - if build && build.output[0]
- %h3{ :class => build.output[0].exit_code == 0 ? "status_build_ok" : "status_build_failed"}
+ - if build
+ %h3{ :class => exit_code_ok?(build) ? "status_build_ok" : "status_build_failed"}
VCS
%ul.unstyled
%li
= render :partial => "builds/step", :locals => {:step => build.output[0], :step_no => 0}
- @build.parts.each_with_index do |part, index|
- %h3{ :class => part.output[0].exit_code == 0 ? "status_build_ok" : "status_build_failed"}
+ %h3{ :class => exit_code_ok?(part) ? "status_build_ok" : "status_build_failed"}
= part.name
%ul{:id => "part_#{index}", :class => 'unstyled' }
- part.output.each_with_index do |output, index|
Please sign in to comment.
Something went wrong with that request. Please try again.