bootstrap_datepicker 0.5 → 0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -1,53 +1,36 @@
1
1
  = Bootstrap Datepicker Rails plugin
2
2
 
3
- This simple gem allows you to add a date picker field into your views.
4
-
5
- == Getting Started
6
-
7
- Pre Rails 3.1:
8
-
9
- 1. Add into your Gemfile:
10
-
11
- gem 'jquery-rails'
12
-
13
- 2. Execute this command to install the needed js files:
14
-
15
- rails generate jquery:install --ui
3
+ This gem allows you to use a beautifull twitter-bootstrap themed date picker on date fields via a simple form helper.
16
4
 
5
+ This gem packs Stefan Petre's amazing jQuery/Bootstrap plugin (http://www.eyecon.ro/bootstrap-datepicker/) with a simple Rails interface.
17
6
 
18
- 3. Insert into your Gemfile:
19
-
20
- gem 'bootstrap_datepicker'
21
-
22
- Don't forget to install the CSS!
7
+ == Getting Started
23
8
 
24
- Rails 3.1:
9
+ for Rails >= 3.1:
25
10
 
26
11
  1. Insert into your Gemfile:
27
12
 
28
13
  gem 'bootstrap_datepicker'
29
14
 
30
- 2. If you are using Rails 3.1 with the asset pipeline enabled (default), the necessary files are already in your asset pipeline. Just add (if they are not already there) to your app/assets/javascripts/application.js:
15
+ 2. If you are using Rails 3.1 with the asset pipeline enabled (default), the necessary files are already in your asset pipeline.
16
+
17
+ Just add (if they are not already there) to your app/assets/javascripts/application.js:
31
18
 
32
19
  //= require jquery
33
20
  //= require jquery-ujs
34
21
  //= require jquery-ui
22
+ //= require twitter/bootstrap
23
+ //= require bootstrap-datepicker
35
24
 
36
- (if you are using datetime picker, add also)
37
-
38
- //= require jquery-ui-timepicker-addon.js
39
-
40
- You can find it here:
41
-
42
- https://github.com/trentrichardson/jQuery-Timepicker-Addon
25
+ The same applies for app/assets/stylesheets/application.css
43
26
 
27
+ *= require bootstrap-datepicker
44
28
 
45
29
  == Usage
46
30
 
47
31
  Add this to your view.
48
32
 
49
- <%= datepicker_input "user","birthday" %>
50
-
33
+ <%= datepicker_input "user", "birthday" %>
51
34
 
52
35
  Where "user" is your model name and "birthday" the name of the datefield.
53
36
 
@@ -67,32 +50,14 @@ Nested attributes are permitted as well:
67
50
  <%= f.submit 'Create' %>
68
51
  <% end %>
69
52
 
70
- You can pass options as it would be a normal text_field, plus all the datepicker options available (http://jqueryui.com/demos/datepicker/#options)
71
-
72
- <%= datepicker_input(:foo, :att1, :minDate => -20, :maxDate => "+1M +10D", :tabindex => 70) %>
73
-
74
- == Use DateTime picker
75
-
76
- If you want to use a datatime picker, download this plugin
77
-
78
- https://github.com/trentrichardson/jQuery-Timepicker-Addon
79
-
80
- and add it to your project (in the assets pipeline if you are using Rails 3.1 or manually otherwise).
81
- Don't forget the CSS! This plugin assume you have installed a jquery-ui theme.
82
-
83
- Then you can use in your views:
84
-
85
- <%= datetime_picker_input "user","loged_in", :dateFormat => "yy-mm-dd" %>
86
-
87
- or
88
-
89
- <% form_for(@user) do |f| %>
90
- <%= f.datetime_picker 'loged_in', :dateFormat => "yy-mm-dd" %>
91
- <%= f.submit 'Create' %>
92
- <% end %>
53
+ You can pass options as it would be a normal text_field, plus all the datepicker options available (http://www.eyecon.ro/bootstrap-datepicker/)
93
54
 
94
- Important! Be aware the way Rails stores the datetime fields cause you'll need to specify the dateFormat to "yy-mm-dd" or pre-process your field value on the controller. The default format won't work.
55
+ <%= datepicker_input(:foo, :att1,
56
+ :format => 'mm/dd/yy',
57
+ :week_start => 0,
58
+ :view_mode => 'years',
59
+ :min_view_mode => 'days') %>
95
60
 
96
61
  == Support
97
62
 
98
- Open an issue in https://github.com/albertopq/jquery_datepicker if you need further support or want to report a bug
63
+ Open an issue in https://github.com/derekstavis/bootstrap_datepicker if you need further support or want to report a bug
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "bootstrap_datepicker"
5
- s.version = "0.5"
5
+ s.version = "0.6"
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", "Derek Willian Stavis"]
@@ -43,21 +43,27 @@ class BootstrapDatepicker::InstanceTag < ActionView::Helpers::InstanceTag
43
43
  end
44
44
 
45
45
  def available_datepicker_options
46
- [:format, :week_start, :view_mode, :min_view_mode, :class]
46
+ [:format, :week_start, :view_mode, :min_view_mode]
47
+ end
48
+
49
+ def available_html_attributes
50
+ [:class, :value, :maxlength]
47
51
  end
48
52
 
49
53
  def baked_options(options)
50
54
  tf_options = Hash.new
51
55
 
52
56
  options.each do |key, value|
57
+
53
58
  if available_datepicker_options.include? key
54
- if key.to_s === "class"
59
+ new_key = ("data-" << key.to_s)
60
+ tf_options[new_key] = value
61
+ end
62
+
63
+ if available_html_attributes.include? key
55
64
  tf_options[key.to_s] = value
56
- else
57
- new_key = ("data-" << key.to_s)
58
- tf_options[new_key] = value
59
- end
60
65
  end
66
+
61
67
  end
62
68
 
63
69
  puts 'options'
metadata CHANGED
@@ -1,44 +1,50 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: bootstrap_datepicker
3
- version: !ruby/object:Gem::Version
4
- version: '0.5'
3
+ version: !ruby/object:Gem::Version
4
+ hash: 7
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 6
9
+ version: "0.6"
6
10
  platform: ruby
7
- authors:
11
+ authors:
8
12
  - Alberto Pastor
9
13
  - Derek Willian Stavis
10
14
  autorequire:
11
15
  bindir: bin
12
16
  cert_chain: []
13
- date: 2012-08-07 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
17
+
18
+ date: 2012-08-07 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
16
21
  name: twitter-bootstrap-rails
17
- requirement: !ruby/object:Gem::Requirement
18
- none: false
19
- requirements:
20
- - - ~>
21
- - !ruby/object:Gem::Version
22
- version: 2.1.1
23
- type: :runtime
24
22
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
23
+ requirement: &id001 !ruby/object:Gem::Requirement
26
24
  none: false
27
- requirements:
25
+ requirements:
28
26
  - - ~>
29
- - !ruby/object:Gem::Version
27
+ - !ruby/object:Gem::Version
28
+ hash: 9
29
+ segments:
30
+ - 2
31
+ - 1
32
+ - 1
30
33
  version: 2.1.1
31
- description: View helper that allows to select dates from a calendar (using jQuery
32
- and Twitter Bootstrap styles)
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ description: View helper that allows to select dates from a calendar (using jQuery and Twitter Bootstrap styles)
33
37
  email: dekestavis@gmail.com
34
38
  executables: []
39
+
35
40
  extensions: []
36
- extra_rdoc_files:
41
+
42
+ extra_rdoc_files:
37
43
  - README.rdoc
38
44
  - lib/app/helpers/datepicker_helper.rb
39
45
  - lib/app/helpers/form_helper.rb
40
46
  - lib/bootstrap_datepicker.rb
41
- files:
47
+ files:
42
48
  - README.rdoc
43
49
  - Rakefile
44
50
  - init.rb
@@ -52,33 +58,42 @@ files:
52
58
  - vendor/assets/stylesheets/bootstrap-datepicker.css
53
59
  homepage: http://github.com/derekstavis/bootstrap_datepicker
54
60
  licenses: []
61
+
55
62
  post_install_message:
56
- rdoc_options:
63
+ rdoc_options:
57
64
  - --line-numbers
58
65
  - --inline-source
59
66
  - --title
60
67
  - bootstrap_datepicker
61
68
  - --main
62
69
  - README.rdoc
63
- require_paths:
70
+ require_paths:
64
71
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
72
+ required_ruby_version: !ruby/object:Gem::Requirement
66
73
  none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
71
- required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ hash: 3
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
72
82
  none: false
73
- requirements:
74
- - - ! '>='
75
- - !ruby/object:Gem::Version
76
- version: '1.2'
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ hash: 11
87
+ segments:
88
+ - 1
89
+ - 2
90
+ version: "1.2"
77
91
  requirements: []
92
+
78
93
  rubyforge_project: bootstrap_datepicker
79
- rubygems_version: 1.8.24
94
+ rubygems_version: 1.8.15
80
95
  signing_key:
81
96
  specification_version: 3
82
- summary: View helper that allows to select dates from a calendar (using jQuery and
83
- Twitter Bootstrap styles)
97
+ summary: View helper that allows to select dates from a calendar (using jQuery and Twitter Bootstrap styles)
84
98
  test_files: []
99
+