jquery_datepicker 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake'
3
3
  require 'echoe'
4
4
  require 'rspec/core/rake_task'
5
5
 
6
- Echoe.new('jquery_datepicker', '0.3.0') do |p|
6
+ Echoe.new('jquery_datepicker', '0.3.1') do |p|
7
7
  p.description = "View helper that allows to select dates from a calendar (using jQuery Ui plugin)"
8
8
  p.url = "http://github.com/albertopq/jquery_datepicker"
9
9
  p.author = "Alberto Pastor"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "jquery_datepicker"
5
- s.version = "0.3.0"
5
+ s.version = "0.3.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Alberto Pastor"]
9
- s.date = "2011-11-06"
9
+ s.date = "2011-11-07"
10
10
  s.description = "View helper that allows to select dates from a calendar (using jQuery Ui plugin)"
11
11
  s.email = "albert.pastor@gmail.com"
12
12
  s.extra_rdoc_files = ["README.rdoc", "lib/app/helpers/datepicker_helper.rb", "lib/app/helpers/form_helper.rb", "lib/jquery_datepicker.rb"]
@@ -8,9 +8,8 @@ module JqueryDatepicker
8
8
  def datepicker(object_name, method, options = {})
9
9
  input_tag = JqueryDatepicker::InstanceTag.new(object_name, method, self, options.delete(:object))
10
10
  dp_options, tf_options = input_tag.split_options(options);
11
- new_options = input_tag.get_to_input_field_tag_options("text", tf_options)
12
- html = input_tag.tag("input", new_options)
13
- html += javascript_tag("jQuery(document).ready(function(){$('##{new_options["id"]}').datepicker(#{dp_options.to_json})});")
11
+ html = input_tag.to_input_field_tag("text", tf_options)
12
+ html += javascript_tag("jQuery(document).ready(function(){$('##{input_tag.get_name_and_id["id"]}').datepicker(#{dp_options.to_json})});")
14
13
  html.html_safe
15
14
  end
16
15
 
@@ -29,16 +28,7 @@ class JqueryDatepicker::InstanceTag < ActionView::Helpers::InstanceTag
29
28
  # Extending ActionView::Helpers::InstanceTag module to make Rails build the name and id
30
29
  # Just returns the options before generate the HTML in order to use the same id and name (see to_input_field_tag mehtod)
31
30
 
32
- def get_to_input_field_tag_options(field_type, options = {})
33
- options = options.stringify_keys
34
- options["size"] = options["maxlength"] || DEFAULT_FIELD_OPTIONS["size"] unless options.key?("size")
35
- options = DEFAULT_FIELD_OPTIONS.merge(options)
36
- if field_type == "hidden"
37
- options.delete("size")
38
- end
39
- options["type"] ||= field_type
40
- options["value"] = options.fetch("value"){ value_before_type_cast(object) } unless field_type == "file"
41
- options["value"] &&= html_escape(options["value"])
31
+ def get_name_and_id(options = {})
42
32
  add_default_name_and_id(options)
43
33
  options
44
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jquery_datepicker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-11-06 00:00:00.000000000Z
12
+ date: 2011-11-07 00:00:00.000000000Z
13
13
  dependencies: []
14
14
  description: View helper that allows to select dates from a calendar (using jQuery
15
15
  Ui plugin)