simple-form-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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 0938de2e99b0efa0c9e3a265c28ea361c80b59b0
4
+ data.tar.gz: 2fd85d38a5f30d447c694f8001765c3098117649
5
+ SHA512:
6
+ metadata.gz: 8b38cdbafdf480b7e965fa36c44d5f0f581e1fb9b202705eedb72eac57c422f5138beea090251d124c55cb22f4529ecb9a7413ff8ae42abdb9e023dbcce1ce11
7
+ data.tar.gz: 18aad533818dd285f7f50e1dcbbdecc1c245ad82b88352d9333e84edc108a81791abab13fce3acb7ca71fa6af4df265bed7235e9ee2ea68c122838b28a05d8bf
data/.document ADDED
@@ -0,0 +1,4 @@
1
+ lib/**/*.rb
2
+ README.rdoc
3
+ ChangeLog.rdoc
4
+ LICENSE.txt
data/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ Gemfile.lock
2
+ html/
3
+ pkg/
4
+ vendor/cache/*.gem
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --colour --format documentation
data/ChangeLog.rdoc ADDED
@@ -0,0 +1,4 @@
1
+ === 0.1.0 / 2013-11-04
2
+
3
+ * Initial release:
4
+
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :rubygems
2
+
3
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 Paul d'Hubert
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.rdoc ADDED
@@ -0,0 +1,65 @@
1
+ = simple-form-datepicker
2
+
3
+ * {Homepage}[https://rubygems.org/gems/simple-form-datepicker]
4
+ * {Documentation}[http://rubydoc.info/gems/simple-form-datepicker/frames]
5
+ * {Email}[mailto:paul at tymate.com]
6
+
7
+ == Description
8
+
9
+ Provides an easy to use date picker for SimpleForm.
10
+
11
+ == Features
12
+
13
+ == Examples
14
+
15
+ require 'simple-form-datepicker'
16
+
17
+ === In your simple forms
18
+
19
+ = input :date_attribute, :as :datepicker
20
+
21
+ === In app/assets/javascripts/application.js
22
+
23
+ //= require jquery.ui.all
24
+
25
+ or
26
+
27
+ //= require jquery.ui.datepicker
28
+
29
+ Also load localisations for JQueryUI's datepicker:
30
+
31
+ //= require jquery.ui.datepicker-en
32
+ //= require jquery.ui.datepicker-es
33
+ //= require jquery.ui.datepicker-fr
34
+
35
+ Initialize JQueryUI's datepicker:
36
+
37
+ $("input.datepicker").each(function(input) {
38
+ $(this).datepicker({
39
+ dateFormat: "yy-mm-dd",
40
+ altField: $(this).next()
41
+ })
42
+
43
+ // If you use i18n-js you can set the locale like that
44
+ $(this).datepicker("option", $.datepicker.regional[I18n.currentLocale()]);
45
+ })
46
+
47
+
48
+ === In app/assets/stylesheets/application.css
49
+
50
+ *= require jquery.ui.datepicker
51
+
52
+ == Requirements
53
+
54
+ - simple_form
55
+ - JqueryUI
56
+
57
+ == Install
58
+
59
+ $ gem install simple-form-datepicker
60
+
61
+ == Copyright
62
+
63
+ Copyright (c) 2013 Paul d'Hubert
64
+
65
+ See LICENSE.txt for details.
data/Rakefile ADDED
@@ -0,0 +1,47 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+
5
+ begin
6
+ require 'bundler'
7
+ rescue LoadError => e
8
+ warn e.message
9
+ warn "Run `gem install bundler` to install Bundler."
10
+ exit -1
11
+ end
12
+
13
+ begin
14
+ Bundler.setup(:development)
15
+ rescue Bundler::BundlerError => e
16
+ warn e.message
17
+ warn "Run `bundle install` to install missing gems."
18
+ exit e.status_code
19
+ end
20
+
21
+ require 'rake'
22
+
23
+ require 'rubygems/tasks'
24
+
25
+ Gem::Tasks.new(:build => {:tar => true, :zip => true},
26
+ :sign => {:checksum => true},
27
+ :scm => {:push => true, :status => true, :tag => true}) do |tasks|
28
+ end
29
+
30
+ Gem::Tasks::Build::Gem.new
31
+ Gem::Tasks::SCM::Status.new
32
+ Gem::Tasks::SCM::Tag.new format: 'release-%s'
33
+ Gem::Tasks::Sign::Checksum.new
34
+ Gem::Tasks::Console.new
35
+
36
+ require 'rdoc/task'
37
+ RDoc::Task.new do |rdoc|
38
+ rdoc.title = "simple-form-datepicker"
39
+ end
40
+ task :doc => :rdoc
41
+
42
+ require 'rspec/core/rake_task'
43
+ RSpec::Core::RakeTask.new
44
+
45
+
46
+ task :test => :spec
47
+ task :default => :spec
@@ -0,0 +1,32 @@
1
+ require 'simple-form-datepicker/version'
2
+
3
+ module SimleFormDatepicker
4
+ end
5
+
6
+ require 'simple_form'
7
+
8
+ # Based on:
9
+ # http://stackoverflow.com/questions/5007785/how-do-i-write-a-cleaner-date-picker-input-for-simpleform
10
+ #
11
+ # Works well with JQueryUI's datepicker and I18n.
12
+ #
13
+ class DatepickerInput < SimpleForm::Inputs::StringInput
14
+ def input_html_options
15
+ value = object.send(attribute_name)
16
+ options = {
17
+ value: value.nil? ? nil : value.strftime("%Y-%m-%d"),
18
+ data: { behaviour: 'datepicker' } # for example
19
+ }
20
+ # add all html option you need...
21
+ super.merge options
22
+ end
23
+
24
+ def input_html_classes
25
+ super.push('datepicker')
26
+ end
27
+
28
+ def input
29
+ @builder.text_field(attribute_name, input_html_options) + \
30
+ @builder.hidden_field(attribute_name, value: input_html_options[:value], class: attribute_name.to_s + "-alt")
31
+ end
32
+ end
@@ -0,0 +1,4 @@
1
+ module SimpleFormDatepicker
2
+ # simple-form-datepicker version
3
+ VERSION = "0.1.0"
4
+ end
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ require File.expand_path('../lib/simple-form-datepicker/version', __FILE__)
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "simple-form-datepicker"
7
+ gem.version = SimpleFormDatepicker::VERSION
8
+ gem.summary = %q{Datepicker inputs for SimpleForm.}
9
+ gem.description = %q{Datepicker inputs for SimpleForm.}
10
+ gem.license = "MIT"
11
+ gem.authors = ["Paul d'Hubert"]
12
+ gem.email = "paul@tymate.com"
13
+ gem.homepage = "https://rubygems.org/gems/simple-form-datepicker"
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ['lib']
18
+
19
+ gem.add_development_dependency 'bundler', '~> 1.0'
20
+ gem.add_development_dependency 'rake', '~> 0.8'
21
+ gem.add_development_dependency 'rdoc', '~> 3.0'
22
+ gem.add_development_dependency 'rspec', '~> 2.4'
23
+ gem.add_development_dependency 'rubygems-tasks', '~> 0.2'
24
+
25
+ gem.add_dependency 'simple_form'
26
+ end
@@ -0,0 +1,8 @@
1
+ require 'spec_helper'
2
+ require 'simple-form-datepicker'
3
+
4
+ describe SimpleFormDatepicker do
5
+ it "should have a VERSION constant" do
6
+ subject.const_get('VERSION').should_not be_empty
7
+ end
8
+ end
@@ -0,0 +1,4 @@
1
+ require 'rspec'
2
+ require 'simple-form-datepicker/version'
3
+
4
+ include SimpleFormDatepicker
metadata ADDED
@@ -0,0 +1,142 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: simple-form-datepicker
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Paul d'Hubert
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-11-04 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '0.8'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '0.8'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.4'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '2.4'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rubygems-tasks
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '0.2'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '0.2'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simple_form
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Datepicker inputs for SimpleForm.
98
+ email: paul@tymate.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files: []
102
+ files:
103
+ - .document
104
+ - .gitignore
105
+ - .rspec
106
+ - ChangeLog.rdoc
107
+ - Gemfile
108
+ - LICENSE.txt
109
+ - README.rdoc
110
+ - Rakefile
111
+ - lib/simple-form-datepicker.rb
112
+ - lib/simple-form-datepicker/version.rb
113
+ - simple-form-datepicker.gemspec
114
+ - spec/datepicker_spec.rb
115
+ - spec/spec_helper.rb
116
+ homepage: https://rubygems.org/gems/simple-form-datepicker
117
+ licenses:
118
+ - MIT
119
+ metadata: {}
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - '>='
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubyforge_project:
136
+ rubygems_version: 2.0.5
137
+ signing_key:
138
+ specification_version: 4
139
+ summary: Datepicker inputs for SimpleForm.
140
+ test_files:
141
+ - spec/datepicker_spec.rb
142
+ - spec/spec_helper.rb