81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/active_scaffold/bridges/shared/date_bridge.rb', line 81
def active_scaffold_human_condition_date_bridge(column, value)
case value['opt']
when 'RANGE'
range_type, range = value['range'].downcase.split('_')
format = active_scaffold_human_condition_date_bridge_range_format(range_type, range)
from, = controller.class.date_bridge_from_to(column, value)
"#{column.active_record_class.human_attribute_name(column.name)} = #{as_(value['range'].downcase).downcase} (#{I18n.l(from, :format => format)})"
when 'PAST', 'FUTURE'
from, to = controller.class.date_bridge_from_to(column, value)
"#{column.active_record_class.human_attribute_name(column.name)} #{as_('BETWEEN'.downcase).downcase} #{I18n.l(from)} - #{I18n.l(to)}"
else
from, to = controller.class.date_bridge_from_to(column, value)
"#{column.active_record_class.human_attribute_name(column.name)} #{as_(value['opt'].downcase).downcase} #{I18n.l(from)} #{value['opt'] == 'BETWEEN' ? '- ' + I18n.l(to) : ''}"
end
end
|