Project

General

Profile

Download (1.17 KB) Statistics
| Branch: | Tag: | Revision:
module HostsHelper
def last_report_column(record)
return nil if record.last_report.nil?
time = time_ago_in_words(record.last_report.getlocal)
image_tag("#{not (record.error_count > 0 or record.no_report)}.png", :size => "18x18") +
link_to_if(record.reports.last, time, report_host_path(record))
end

def root_pass_form_column(record, field_name)
password_field_tag field_name, record.root_pass
end

# method that reformats the hostname column by adding the status icons
def name_column(record)
if record.build and not record.installed_at.nil?
image ="attention_required.png"
title = "Pending Installation"
elsif (os=record.fv(:kernel)).nil?
image = "warning.png"
title = "No Inventory Data"
else
image = "#{os}.jpg"
title = os
end
image_tag("hosts/#{image}", :size => "18x18", :title => title) +
link_to(record.shortname, edit_host_url(record))
end

def disk_form_column(record, field_name)
text_area_tag field_name, record.disk, :cols => 120, :rows => 10
end

def comment_form_column(record, field_name)
text_area_tag field_name, record.comment, :cols => 120, :rows => 10
end


end
(12-12/21)