Module: OperatingsystemsHelper

Includes:
CommonParametersHelper
Included in:
HostsHelper
Defined in:
app/helpers/operatingsystems_helper.rb

Instance Method Summary collapse

Methods included from CommonParametersHelper

#authorized_via_my_scope, #parameter_value_field, #parameters_title

Instance Method Details

#icon(record, opts = {}) ⇒ Object


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/operatingsystems_helper.rb', line 4

def icon record, opts = {}
  return "" if record.blank? or record.name.blank?
  family = case record.name
  when /fedora/i
    "Fedora"
  when /ubuntu/i
    "Ubuntu"
  when /solaris|sunos/i
    "Solaris"
  when /darwin/i
    "Darwin"
  when /centos/i
    "Centos"
  when /scientific/i
    "Scientific"
  when /archlinux/i
    "Archlinux"
  when /gentoo/i
    "Gentoo"
  when /SLC/i
    "SLC"
  else
    return "" if record.family.blank?
    record.family
  end

  image_tag(family+".png", opts) + " "
end

#os_habtm_family(type, obj) ⇒ Object


37
38
39
40
# File 'app/helpers/operatingsystems_helper.rb', line 37

def os_habtm_family type, obj
  result = type.where(:os_family => obj.family)
  result.empty? ? type : result
end

#os_name(record, opts = {}) ⇒ Object


33
34
35
# File 'app/helpers/operatingsystems_helper.rb', line 33

def os_name record, opts = {}
  "#{icon(record, opts)} #{record}".html_safe
end