jquery_datepicker 0.2.0 → 0.3.0

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.2.0') do |p|
6
+ Echoe.new('jquery_datepicker', '0.3.0') 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.2.0"
5
+ s.version = "0.3.0"
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-05"
9
+ s.date = "2011-11-06"
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"]
@@ -7,13 +7,15 @@ module JqueryDatepicker
7
7
  # Mehtod that generates datepicker input field inside a form
8
8
  def datepicker(object_name, method, options = {})
9
9
  input_tag = JqueryDatepicker::InstanceTag.new(object_name, method, self, options.delete(:object))
10
- new_options = input_tag.get_to_input_field_tag_options("text", options)
10
+ dp_options, tf_options = input_tag.split_options(options);
11
+ new_options = input_tag.get_to_input_field_tag_options("text", tf_options)
11
12
  html = input_tag.tag("input", new_options)
12
- html += javascript_tag("jQuery(document).ready(function(){$('##{new_options["id"]}').datepicker()});")
13
+ html += javascript_tag("jQuery(document).ready(function(){$('##{new_options["id"]}').datepicker(#{dp_options.to_json})});")
13
14
  html.html_safe
14
15
  end
15
16
 
16
17
  end
18
+
17
19
  end
18
20
 
19
21
  module JqueryDatepicker::FormBuilder
@@ -40,5 +42,14 @@ class JqueryDatepicker::InstanceTag < ActionView::Helpers::InstanceTag
40
42
  add_default_name_and_id(options)
41
43
  options
42
44
  end
45
+
46
+ def available_datepicker_options
47
+ [:disabled, :altField, :altFormat, :appendText, :autoSize, :buttonImage, :buttonImageOnly, :buttonText, :calculateWeek, :changeMonth, :changeYear, :closeText, :constrainInput, :currentText, :dateFormat, :dayNames, :dayNamesMin, :dayNamesShort, :defaultDate, :duration, :firstDay, :gotoCurrent, :hideIfNoPrevNext, :isRTL, :maxDate, :minDate, :monthNames, :monthNamesShort, :navigationAsDateFormat, :nextText, :numberOfMonths, :prevText, :selectOtherMonths, :shortYearCutoff, :showAnim, :showButtonPanel, :showCurrentAtPos, :showMonthAfterYear, :showOn, :showOptions, :showOtherMonths, :showWeek, :stepMonths, :weekHeader, :yearRange, :yearSuffix]
48
+ end
49
+
50
+ def split_options(options)
51
+ tf_options = options.slice!(*available_datepicker_options)
52
+ return options, tf_options
53
+ end
43
54
 
44
55
  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.2.0
4
+ version: 0.3.0
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-05 00:00:00.000000000Z
12
+ date: 2011-11-06 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)