will_pickdate 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/will_pickdate/pickdate_builder.rb +22 -25
- data/lib/will_pickdate/version.rb +1 -1
- data/lib/will_pickdate.rb +3 -1
- metadata +1 -1
@@ -1,31 +1,28 @@
|
|
1
|
-
module
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
end
|
1
|
+
module PickdateHelper
|
2
|
+
def datetime_field(object_name, method, options = {})
|
3
|
+
InstanceTag.new(object_name, method, self, options.delete(:object)).to_datetime_field_tag(options)
|
4
|
+
end
|
5
|
+
end
|
7
6
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
module PickdateHelperInstanceTag
|
8
|
+
def to_datetime_field_tag(options = {})
|
9
|
+
options = options.stringify_keys
|
10
|
+
options = DEFAULT_FIELD_OPTIONS.merge(options)
|
12
11
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
options["type"] = "datetime"
|
13
|
+
options["value"] = options.fetch("value"){ value_before_type_cast(object).iso8601 }
|
14
|
+
options["value"] &&= ERB::Util.html_escape(options["value"])
|
15
|
+
add_default_name_and_id(options)
|
16
|
+
tag("input", options)
|
17
|
+
end
|
18
|
+
end
|
20
19
|
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
class ActionView::Helpers::InstanceTag
|
21
|
+
include PickdateHelperInstanceTag
|
22
|
+
end
|
24
23
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
end
|
29
|
-
end
|
24
|
+
class ActionView::Helpers::FormBuilder
|
25
|
+
def datetime_field(method, options = {})
|
26
|
+
@template.datetime_select(@object_name, method, objectify_options(options))
|
30
27
|
end
|
31
28
|
end
|
data/lib/will_pickdate.rb
CHANGED