Module: MaintenanceLightHelper

Defined in:
app/helpers/maintenance_light_helper.rb

Instance Method Summary collapse

Instance Method Details

#format_maintenance_light(arg, options = {}) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'app/helpers/maintenance_light_helper.rb', line 3

def format_maintenance_light(arg, options={})
  maintenance_light = arg.respond_to?(:maintenance_light) ? arg.maintenance_light : arg
  return "—".html_safe if maintenance_light.nil?

  html = <<-HTML
  <span class="maintenance-light" rel="tooltip" title="#{maintenance_light.message}">
    <i class="stoplight #{maintenance_light.color}"></i>
    #{maintenance_light.dependency_name if options.fetch(:with_name, false)}
    #{maintenance_light.version}
  </span>
  HTML
  html.html_safe
rescue Rubygems::Error
  "?".html_safe
end