tap/app/helpers/application_helper.rb

21 lines
407 B
Ruby
Raw Normal View History

2014-12-09 13:10:36 +01:00
require 'digest/md5'
2014-11-06 14:46:59 +01:00
module ApplicationHelper
2014-12-09 13:10:36 +01:00
def get_color(user)
2014-12-10 05:13:17 +01:00
Digest::MD5.hexdigest(user.nickname)[0..5]
2014-12-09 13:10:36 +01:00
end
def get_color_style(user)
2014-12-10 05:13:17 +01:00
"background-color: \#"+ get_color(user) +";"
2014-12-09 13:10:36 +01:00
end
2014-12-09 14:39:27 +01:00
def euro(f)
number_to_currency(f, unit: '€')
2014-12-09 14:39:27 +01:00
end
2015-02-09 11:58:43 +01:00
def f_form_for(record, options = {}, &block)
options[:builder] = FormattedFormBuilder
form_for(record, options, &block)
2014-12-09 14:39:27 +01:00
end
2014-11-06 14:46:59 +01:00
end