foreman/app/helpers/reports_helper.rb @ 459e0feb
eafaf5f1 | Ohad Levy | module ReportsHelper
|
|
9f9a8052 | Ohad Levy | ||
def reported_at_column(record)
|
|||
if record.error?
|
|||
img = "hosts/warning"
|
|||
elsif record.changes?
|
|||
img = "hosts/attention_required"
|
|||
else
|
|||
img = "true"
|
|||
end
|
|||
244bdd5a | Ohad Levy | image_tag("#{img}.png", :size => "18x18") + " " +
|
|
link_to(time_ago_in_words(record.reported_at.getlocal), report_path(record))
|
|||
eafaf5f1 | Ohad Levy | end
|
|
459e0feb | Paul Kelly | ||
def reports_since builder
|
|||
choices = [30,60,90].map{|i| OpenStruct.new :name => "#{i} minutes ago", :value => i.minutes.ago }
|
|||
choices += (1..7).map{|i| OpenStruct.new :name => "#{pluralize(i, 'day')} ago", :value => i.days.ago }
|
|||
choices += [OpenStruct.new :name => "1 week ago", :value => 1.week.ago]
|
|||
choices += [OpenStruct.new :name => "2 weeks ago", :value => 2.week.ago]
|
|||
choices += [OpenStruct.new :name => "1 month ago", :value => 1.month.ago]
|
|||
choices += [OpenStruct.new :name => "3 months ago", :value => 3.month.ago]
|
|||
choices += [OpenStruct.new :name => "All Reports", :value => Report.first(:select => "created_at").created_at]
|
|||
builder.collection_select :reported_at_gt, choices, :value, :name, {:include_blank => "Select a period"}
|
|||
end
|
|||
eafaf5f1 | Ohad Levy | end
|