module VersionReportsHelper def display_issue(issue, *options) text = issue.subject text = text.sub(/\!\!\w*/,'') if options.include? :tracker text = "#{issue.tracker} ##{issue.id} " + text end link_to text, issue_path(issue) end def hours_to_money(hours) "$%i" % (hours*50) end def hour_budget(issue) v = issue.custom_field_values.detect {|value| value.custom_field.name == 'Hour Budget' } if v v.value.to_i end end def hour_budget_error(issue) return unless @show_hours budget = hour_budget(issue) if issue.total_spent_hours != budget if issue.total_spent_hours < budget content_tag :div, :class => 'flash error' do "%s under budget!" % l_hours(budget - issue.total_spent_hours) end elsif issue.total_spent_hours > budget content_tag :div, :class => 'flash warning' do "%s over budget!" % l_hours(issue.total_spent_hours - budget) end end end end end