Skip to content

Commit

Permalink
Fixes #2749 - power status helper can handle unknown states
Browse files Browse the repository at this point in the history
  • Loading branch information
ares authored and dLobatog committed Feb 16, 2015
1 parent a61a134 commit 2c7ea23
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/helpers/bmc_helper.rb
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
module BmcHelper

def power_status(s)
if s.downcase == 'on'
case s.try(:downcase)
when 'on'
"<span class='label label-success'>#{_('On')}</span>".html_safe
else
when 'off'
"<span class='label label-default'>#{_('Off')}</span>".html_safe
else
"<span class='label label-default'>#{_('Unknown status: %s') % s.inspect}</span>".html_safe
end
end

Expand Down

0 comments on commit 2c7ea23

Please sign in to comment.