jquery_datepicker 0.1.0

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.
data/Manifest ADDED
@@ -0,0 +1,8 @@
1
+ Manifest
2
+ README.rdoc
3
+ Rakefile
4
+ init.rb
5
+ jquery_datepicker.gemspec
6
+ lib/app/helpers/datepicker_helper.rb
7
+ lib/app/helpers/form_helper.rb
8
+ lib/jquery_datepicker.rb
data/README.rdoc ADDED
@@ -0,0 +1,34 @@
1
+ = jQuery Datepicker Rails plugin
2
+
3
+ This simple gem allows you to add a date picker field into your views.
4
+
5
+ == Installation
6
+
7
+ As this gem is using jQuery Ui plugin, be sure that you are already using jquery into your project. In order to install it:
8
+
9
+ * Add into your Gemfile
10
+ gem 'jquery-rails'
11
+
12
+ * Execute this command to install the needed js files
13
+
14
+ rails generate jquery:install --ui
15
+
16
+ * Insert into your Gemfile:
17
+
18
+ gem 'jquery_datepicker'
19
+
20
+ == Usage
21
+
22
+ Add this to your view.
23
+
24
+ <%= datepicker_input "user","birthday" %>
25
+
26
+ Where "user" is your model name and "birthday" the name of the datefield.
27
+
28
+ You can also use it with the form helper like:
29
+
30
+ <% form_for(@user) do |f| %>
31
+ <%= f.datepicker 'birthday' %>
32
+ <%= f.submit 'Create' %>
33
+ <% end %>
34
+
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'echoe'
4
+
5
+ Echoe.new('jquery_datepicker', '0.1.0') do |p|
6
+ p.description = "View helper that allows to select dates from a calendar (using jQuery Ui plugin)"
7
+ p.url = "http://github.com/albertopq/jquery_datepicker"
8
+ p.author = "Alberto Pastor"
9
+ p.email = "albert.pastor@gmail.com"
10
+ p.ignore_pattern = ["tmp/*", "script/*"]
11
+ p.development_dependencies = []
12
+ end
13
+
14
+ Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'jquery_datepicker'
@@ -0,0 +1,29 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = "jquery_datepicker"
5
+ s.version = "0.1.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Alberto Pastor"]
9
+ s.date = "2011-10-16"
10
+ s.description = "View helper that allows to select dates from a calendar (using jQuery Ui plugin)"
11
+ s.email = "albert.pastor@gmail.com"
12
+ s.extra_rdoc_files = ["README.rdoc", "lib/app/helpers/datepicker_helper.rb", "lib/app/helpers/form_helper.rb", "lib/jquery_datepicker.rb"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "jquery_datepicker.gemspec", "lib/app/helpers/datepicker_helper.rb", "lib/app/helpers/form_helper.rb", "lib/jquery_datepicker.rb"]
14
+ s.homepage = "http://github.com/albertopq/jquery_datepicker"
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Jquery_datepicker", "--main", "README.rdoc"]
16
+ s.require_paths = ["lib"]
17
+ s.rubyforge_project = "jquery_datepicker"
18
+ s.rubygems_version = "1.8.10"
19
+ s.summary = "View helper that allows to select dates from a calendar (using jQuery Ui plugin)"
20
+
21
+ if s.respond_to? :specification_version then
22
+ s.specification_version = 3
23
+
24
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
25
+ else
26
+ end
27
+ else
28
+ end
29
+ end
@@ -0,0 +1,10 @@
1
+ module DatepickerHelper
2
+
3
+ # Helper method that creates a datepicker input field
4
+ def datepicker_input(model, att)
5
+ html = text_field(model,att)
6
+ html += javascript_tag 'jQuery(document).ready(function(){$("#'+model.to_s+'_'+att.to_s+'").datepicker()});'
7
+ return html
8
+ end
9
+
10
+ end
@@ -0,0 +1,11 @@
1
+ module FormHelper
2
+
3
+ # Mehtod that generates datepicker input field inside a form
4
+ def datepicker(att)
5
+ model = self.object_name
6
+ html = self.text_field att
7
+ html += '<script type="text/javascript">jQuery(document).ready(function(){$("#'+model+'_'+att.to_s+'").datepicker()});</script>'
8
+ return html
9
+ end
10
+
11
+ end
@@ -0,0 +1,8 @@
1
+ # JqueryDatepicker
2
+ require "app/helpers/datepicker_helper.rb"
3
+ require "app/helpers/form_helper.rb"
4
+
5
+ %w{ helpers }.each do |dir|
6
+ ActionView::Base.send(:include, DatepickerHelper)
7
+ ActionView::Helpers::FormBuilder.send(:include, FormHelper)
8
+ end
metadata ADDED
@@ -0,0 +1,64 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jquery_datepicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Alberto Pastor
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-10-16 00:00:00.000000000Z
13
+ dependencies: []
14
+ description: View helper that allows to select dates from a calendar (using jQuery
15
+ Ui plugin)
16
+ email: albert.pastor@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - README.rdoc
21
+ - lib/app/helpers/datepicker_helper.rb
22
+ - lib/app/helpers/form_helper.rb
23
+ - lib/jquery_datepicker.rb
24
+ files:
25
+ - Manifest
26
+ - README.rdoc
27
+ - Rakefile
28
+ - init.rb
29
+ - jquery_datepicker.gemspec
30
+ - lib/app/helpers/datepicker_helper.rb
31
+ - lib/app/helpers/form_helper.rb
32
+ - lib/jquery_datepicker.rb
33
+ homepage: http://github.com/albertopq/jquery_datepicker
34
+ licenses: []
35
+ post_install_message:
36
+ rdoc_options:
37
+ - --line-numbers
38
+ - --inline-source
39
+ - --title
40
+ - Jquery_datepicker
41
+ - --main
42
+ - README.rdoc
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ none: false
47
+ requirements:
48
+ - - ! '>='
49
+ - !ruby/object:Gem::Version
50
+ version: '0'
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ none: false
53
+ requirements:
54
+ - - ! '>='
55
+ - !ruby/object:Gem::Version
56
+ version: '1.2'
57
+ requirements: []
58
+ rubyforge_project: jquery_datepicker
59
+ rubygems_version: 1.8.10
60
+ signing_key:
61
+ specification_version: 3
62
+ summary: View helper that allows to select dates from a calendar (using jQuery Ui
63
+ plugin)
64
+ test_files: []