2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'app/inputs/date_picker_input.rb', line 2
def input(wrapper_options)
floating = options.fetch(:floating, false)
input_html_options[:type] = :text
input_html_options[:placeholder] ||= 'MM/DD/YYYY'
input_html_options[:'data-input'] = ''
input_html_options[:class] = [input_html_options[:class], 'pe-5'].compact.join(' ')
style_css = input_html_options.delete(:style)
if floating
input_html_options[:placeholder] ||= ' '
input_html_options[:class] = [input_html_options[:class], 'form-control'].compact.join(' ')
template.content_tag(:div, class: 'form-floating date_picker_wrapper date-picker_wrapper_single', style: style_css, data: { controller: 'date-picker' }) do
template.concat super(wrapper_options)
template.concat floating_label_tag
template.concat clear_btn
end
else
out = ActiveSupport::SafeBuffer.new
out << template.content_tag(:div,
class: 'date_picker_wrapper date-picker_wrapper_single d-flex align-items-center position-relative',
style: style_css,
data: { controller: 'date-picker' }) do
template.concat super(wrapper_options)
template.concat clear_btn
end
out
end
end
|