From 279477c776ed70606d54e8acc36e6e03f00edfc2 Mon Sep 17 00:00:00 2001 From: Markus Kahl Date: Thu, 24 Mar 2011 17:02:47 +0100 Subject: [PATCH] made multi_choice filter understand symbols for labels as i18n keys --- lib/widget/filters/multi_choice.rb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/widget/filters/multi_choice.rb b/lib/widget/filters/multi_choice.rb index ddeb9ba18c..365a982692 100644 --- a/lib/widget/filters/multi_choice.rb +++ b/lib/widget/filters/multi_choice.rb @@ -13,7 +13,7 @@ class Widget::Filters::MultiChoice < Widget::Filters::Base } opts[:checked] = "checked" if filter.values == value radio_button = tag :input, opts - content_tag :label, radio_button + label, + content_tag :label, radio_button + translate(label), :for => "#{filterName}_radio_option_#{i}", :'data-filter-name' => filter_class.underscore_name, :class => "#{filterName}_radio_option filter_radio_option" @@ -23,4 +23,15 @@ class Widget::Filters::MultiChoice < Widget::Filters::Base end end end + + private + + def translate(label) + if label.is_a?(Symbol) + ::I18n.t(label) + else + label + end + end + end