simple_form_bootstrap3 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: badf8b8266ad0ff704e36354f7624e6c7767a639
|
4
|
+
data.tar.gz: 172394a4dce577876613761a90a39443dbcfb02b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb1e024dffe8d9e8ebc8f339ce6b4d5321da139a5a6eeea4366cae1d8c957195382a4ade6bfd9ada5c2e3236d308403c4f4d0eaeb8ff102062424f5433c0e7eb
|
7
|
+
data.tar.gz: 89640a074f7efd2bddb4c479efb79adb8f67d6b5177ad266ea0470d8118debd29a6373261ba6828debde35d37cc6bade96e7fb0bd6744ca620c7181a474e35da
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module SimpleForm
|
2
2
|
class DefaultFormBuilder < SimpleForm::FormBuilder
|
3
|
-
map_type :datetime,
|
4
|
-
map_type :
|
3
|
+
map_type :datetime, to: SimpleForm::Inputs::DateTimePickerInput
|
4
|
+
map_type :date, to: SimpleForm::Inputs::DatePickerInput
|
5
5
|
|
6
6
|
def checkbox(attribute_name, options = {}, &block)
|
7
7
|
options[:wrapper] ||= :checkbox
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SimpleForm
|
2
|
+
module Inputs
|
3
|
+
class DatePickerInput < Base
|
4
|
+
def input
|
5
|
+
template.content_tag(:div, class: 'input-group date datepicker') do
|
6
|
+
template.concat span_calendar
|
7
|
+
template.concat @builder.datetime_field(attribute_name, input_html_options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def input_html_options
|
14
|
+
{ class: 'form-control', readonly: true, value: object.send(attribute_name).strftime("%Y-%m-%d") }
|
15
|
+
end
|
16
|
+
|
17
|
+
def span_calendar
|
18
|
+
template.content_tag(:span, class: 'input-group-addon') do
|
19
|
+
template.concat icon_calendar
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def icon_calendar
|
24
|
+
'<i class="glyphicon glyphicon-calendar"></i>'.html_safe
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module SimpleForm
|
2
|
+
module Inputs
|
3
|
+
class DateTimePickerInput < Base
|
4
|
+
def input
|
5
|
+
template.content_tag(:div, class: 'input-group date datetimepicker') do
|
6
|
+
template.concat span_calendar
|
7
|
+
template.concat @builder.datetime_field(attribute_name, input_html_options)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def input_html_options
|
14
|
+
{ class: 'form-control', readonly: true, value: object.send(attribute_name).strftime("%Y-%m-%d %H:%M") }
|
15
|
+
end
|
16
|
+
|
17
|
+
def span_calendar
|
18
|
+
template.content_tag(:span, class: 'input-group-addon') do
|
19
|
+
template.concat icon_calendar
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def icon_calendar
|
24
|
+
'<i class="glyphicon glyphicon-calendar"></i>'.html_safe
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_form_bootstrap3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yuriy Kolodovskyy
|
@@ -53,6 +53,8 @@ files:
|
|
53
53
|
- lib/simple_form/default_form_builder.rb
|
54
54
|
- lib/simple_form/horizontal_form_builder.rb
|
55
55
|
- lib/simple_form/inline_form_builder.rb
|
56
|
+
- lib/simple_form/inputs/date_picker_input.rb
|
57
|
+
- lib/simple_form/inputs/date_time_picker_input.rb
|
56
58
|
- lib/simple_form/placeholder_form_builder.rb
|
57
59
|
- lib/simple_form_bootstrap3/engine.rb
|
58
60
|
- lib/simple_form_bootstrap3/version.rb
|