simple-form-datepicker 0.1.1 → 0.1.2
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 +4 -4
- data/lib/simple-form-datepicker.rb +5 -1
- data/lib/simple-form-datepicker/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: edd55597aa50698a280c64565349c5d1aa7e0e69
|
4
|
+
data.tar.gz: 77e22198759b6cd15f41d26372cb82ecac4873dd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69e892e8bc1b6f067fdad710bb19940b39a884aaa1caa68a8ebbda3b601164662bb9f074b3045e3fb2bd1c22bf3f6f88bfce051aed094250d269c84c9ed30301
|
7
|
+
data.tar.gz: 9b0112906236a128f83a3f9ba48e529cda85d5c1dd1c22b6c010f86782e18024a55adbab950aeff62f59a0ed07b30a33488c382aa4b1e83e635aa51b67b68313
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'simple-form-datepicker/version'
|
2
2
|
|
3
|
-
module
|
3
|
+
module SimpleFormDatepicker
|
4
4
|
end
|
5
5
|
|
6
6
|
require 'simple_form'
|
@@ -11,6 +11,8 @@ require 'simple_form'
|
|
11
11
|
# Works well with JQueryUI's datepicker and I18n.
|
12
12
|
#
|
13
13
|
class DatepickerInput < SimpleForm::Inputs::StringInput
|
14
|
+
# Builds options for the dateicker input, sets it's value using
|
15
|
+
# Rails's date format and adds behaviour: 'datepicker' to its date-atrributes.
|
14
16
|
def input_html_options
|
15
17
|
value = object.send(attribute_name)
|
16
18
|
options = {
|
@@ -21,10 +23,12 @@ class DatepickerInput < SimpleForm::Inputs::StringInput
|
|
21
23
|
super.merge options
|
22
24
|
end
|
23
25
|
|
26
|
+
# Adds the "datepicker" class to the input element
|
24
27
|
def input_html_classes
|
25
28
|
super.push('datepicker')
|
26
29
|
end
|
27
30
|
|
31
|
+
# Builds the input text field and an hidden field with class attribute_name-alt
|
28
32
|
def input
|
29
33
|
@builder.text_field(attribute_name, input_html_options) + \
|
30
34
|
@builder.hidden_field(attribute_name, value: input_html_options[:value], class: attribute_name.to_s + "-alt")
|