simple_form_bootstrap3 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f2a4fd3b596c399f76389c14b13c42280e47831
4
- data.tar.gz: 5acd83355d344ef2d17a1c1e3d59759d03578793
3
+ metadata.gz: badf8b8266ad0ff704e36354f7624e6c7767a639
4
+ data.tar.gz: 172394a4dce577876613761a90a39443dbcfb02b
5
5
  SHA512:
6
- metadata.gz: c68233293cf005b0b454576f5135c6d457a778d5885d32b9cee4eee13716dab25057cd7c9823f2dabd2b64d41d12c455a3dae059a0a4a615f9128942e0313288
7
- data.tar.gz: 1b24bcdf1945d04b13a9ca0cb08a887d851604924d26eca29bbf3f19a1249b69618db4565edab97032c6e9bbd23babe0d16ad9a1d3391c903b4c17fb871891f3
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, to: DateTimePickerInput
4
- map_type :time, :date, to: DatePickerInput
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
@@ -1,3 +1,3 @@
1
1
  module SimpleFormBootstrap3
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  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.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