10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/inputs/radio_with_clear_input.rb', line 10
def input
input_options[:collection_wrapper_tag] ||= options.fetch(:collection_wrapper_tag, SimpleForm.collection_wrapper_tag)
input_options[:item_wrapper_class] ||= 'uc-form-collection-item'
hidden_field = @builder.hidden_field(
attribute_name,
input_html_options.merge(:value => nil).merge(
class: input_html_classes.join(' ')
)
)
label_method, value_method = detect_collection_methods
input_dom = @builder.send(:"collection_#{input_type}_buttons",
attribute_name, collection,
value_method, label_method,
input_options, input_html_options)
dom = <<-STRING
<fieldset class='radio_buttons normal row uc-form-fieldset-radio-with-clear'>
<div class="three fifths small-tablet pad-right">
<legend class="uc-form-legend">#{input_options[:label]}</legend>
</div>
<div class='options two fifths small-tablet align-right' data-presents='radio_with_clear'>
#{hidden_field}
#{input_dom}
<a href='#'>clear</a>
</div>
</fieldset>
STRING
dom.html_safe
end
|