|
|
|
@ -3,26 +3,17 @@ class Widget::Filters::MultiChoice < Widget::Filters::Base |
|
|
|
|
def render |
|
|
|
|
content_tag :td do |
|
|
|
|
content_tag :div, :id => "#{filter_class.underscore_name}_arg_1", :class => "filter_values" do |
|
|
|
|
content = '' |
|
|
|
|
available_values = filter_class.available_values |
|
|
|
|
available_values.each_with_index do |(label, value), i| |
|
|
|
|
label = content_tag :label, |
|
|
|
|
:for => "#{filter_class.underscore_name}_radio_option_#{i}", |
|
|
|
|
:'data-filter-name' => filter_class.underscore_name do |
|
|
|
|
radio_button = content_tag :input, |
|
|
|
|
:type => 'radio', |
|
|
|
|
:name => "#{filter_class.underscore_name}_arg_1_val", |
|
|
|
|
choices = filter_class.available_values.each_with_index.map do |(label, value), i| |
|
|
|
|
radio_button = tag :input, |
|
|
|
|
:type => "radio", :name => "#{filter_class.underscore_name}_arg_1_val", |
|
|
|
|
:id => "#{filter_class.underscore_name}_radio_option_#{i}", |
|
|
|
|
:class => "#{filter_class.underscore_name}_radio_option", |
|
|
|
|
:value => value do |
|
|
|
|
'' |
|
|
|
|
end |
|
|
|
|
radio_button + label |
|
|
|
|
end |
|
|
|
|
br = (i == available_values.size - 1) ? '' : content_tag(:br) {} |
|
|
|
|
content += (label + br) |
|
|
|
|
:value => value |
|
|
|
|
content_tag :label, radio_button + label, |
|
|
|
|
:for => "#{filter_class.underscore_name}_radio_option_#{i}", |
|
|
|
|
:'data-filter-name' => filter_class.underscore_name |
|
|
|
|
end |
|
|
|
|
content.html_safe |
|
|
|
|
choices.join(content_tag(:br)).html_safe |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|
end |
|
|
|
|