simple-form-datepicker-reloaded 0.1.3
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 +7 -0
- data/ChangeLog.rdoc +4 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +75 -0
- data/Rakefile +47 -0
- data/lib/simple-form-datepicker.rb +36 -0
- data/lib/simple-form-datepicker/version.rb +4 -0
- data/simple-form-datepicker.gemspec +26 -0
- data/spec/datepicker_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -0
- metadata +139 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c609e793fd9965ffde6f23e6bcfb6ed0ba603e15
|
4
|
+
data.tar.gz: ec9092f07690f67746a0e57a8d70f36a7e69e529
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7f47c972e5886efac4856fab71cf6fdc1fd747ef4c5ee882ba07d444ed4449e4b6ff0153a13a194239cb67d9bc9d323118cc38a51de6c9f1bbe713de3acf74da
|
7
|
+
data.tar.gz: 20db2ded568dd492e2cabfb30080fdb5e36f126e89c5334f48bcac6d03ef57e696157e6872e3fcb02c67706f99889394854319b22d0368e20dfa8c348b054522
|
data/ChangeLog.rdoc
ADDED
data/Gemfile
ADDED
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,75 @@
|
|
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
|
+
{<img src="https://badge.fury.io/rb/simple-form-datepicker.png" alt="Gem Version" />}[http://badge.fury.io/rb/simple-form-datepicker]
|
8
|
+
|
9
|
+
== Description
|
10
|
+
|
11
|
+
Provides an easy to use date picker for SimpleForm.
|
12
|
+
|
13
|
+
== Features
|
14
|
+
|
15
|
+
- Easy to use.
|
16
|
+
- Localizable with I18n and I18n-js.
|
17
|
+
|
18
|
+
== Examples
|
19
|
+
|
20
|
+
require 'simple-form-datepicker'
|
21
|
+
|
22
|
+
=== In your simple forms
|
23
|
+
|
24
|
+
= f.input :date_attribute, :as :datepicker
|
25
|
+
|
26
|
+
=== In app/assets/javascripts/application.js
|
27
|
+
|
28
|
+
//= require jquery.ui.all
|
29
|
+
|
30
|
+
or
|
31
|
+
|
32
|
+
//= require jquery.ui.datepicker
|
33
|
+
|
34
|
+
Also load localisations for JQueryUI's datepicker:
|
35
|
+
|
36
|
+
//= require jquery.ui.datepicker-en
|
37
|
+
//= require jquery.ui.datepicker-es
|
38
|
+
//= require jquery.ui.datepicker-fr
|
39
|
+
|
40
|
+
Initialize JQueryUI's datepicker:
|
41
|
+
|
42
|
+
$("input.datepicker").each(function(input) {
|
43
|
+
$(this).datepicker({
|
44
|
+
dateFormat: "yy-mm-dd",
|
45
|
+
altField: $(this).next()
|
46
|
+
})
|
47
|
+
|
48
|
+
// If you use i18n-js you can set the locale like that
|
49
|
+
$(this).datepicker("option", $.datepicker.regional[I18n.currentLocale()]);
|
50
|
+
})
|
51
|
+
|
52
|
+
|
53
|
+
=== In app/assets/stylesheets/application.css
|
54
|
+
|
55
|
+
*= require jquery.ui.datepicker
|
56
|
+
|
57
|
+
== Requirements
|
58
|
+
|
59
|
+
- simple_form
|
60
|
+
- JqueryUI / jquery-ui-rails
|
61
|
+
|
62
|
+
== TODO
|
63
|
+
|
64
|
+
- How to use with i18n-js.
|
65
|
+
|
66
|
+
== Install
|
67
|
+
|
68
|
+
|
69
|
+
$ gem install simple-form-datepicker
|
70
|
+
|
71
|
+
== Copyright
|
72
|
+
|
73
|
+
Copyright (c) 2013 Paul d'Hubert
|
74
|
+
|
75
|
+
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,36 @@
|
|
1
|
+
require 'simple-form-datepicker/version'
|
2
|
+
|
3
|
+
module SimpleFormDatepicker
|
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
|
+
# Builds options for the dateicker input, sets it's value using
|
15
|
+
# Rails's date format and adds behaviour: 'datepicker' to its date-atrributes.
|
16
|
+
def input_html_options
|
17
|
+
value = object.send(attribute_name)
|
18
|
+
options = {
|
19
|
+
value: value.nil? ? nil : value.strftime("%Y-%m-%d"),
|
20
|
+
data: { behaviour: 'datepicker' } # for example
|
21
|
+
}
|
22
|
+
# add all html option you need...
|
23
|
+
super.merge options
|
24
|
+
end
|
25
|
+
|
26
|
+
# Adds the "datepicker" class to the input element
|
27
|
+
def input_html_classes
|
28
|
+
super.push('datepicker')
|
29
|
+
end
|
30
|
+
|
31
|
+
# Builds the input text field and an hidden field with class attribute_name-alt
|
32
|
+
def input(wrapper_options)
|
33
|
+
@builder.text_field(attribute_name, input_html_options) + \
|
34
|
+
@builder.hidden_field(attribute_name, value: input_html_options[:value], class: attribute_name.to_s + "-alt")
|
35
|
+
end
|
36
|
+
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-reloaded"
|
7
|
+
gem.version = SimpleFormDatepicker::VERSION
|
8
|
+
gem.summary = %q{Datepicker inputs for SimpleForm, updated for 3.1.0.}
|
9
|
+
gem.description = %q{Datepicker inputs for SimpleForm, updated for 3.1.0.}
|
10
|
+
gem.license = "MIT"
|
11
|
+
gem.authors = ["Paul d'Hubert"]
|
12
|
+
gem.email = "paul@tymate.com"
|
13
|
+
gem.homepage = "https://github.com/JasonBarnabe/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
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple-form-datepicker-reloaded
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Paul d'Hubert
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-07 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, updated for 3.1.0.
|
98
|
+
email: paul@tymate.com
|
99
|
+
executables: []
|
100
|
+
extensions: []
|
101
|
+
extra_rdoc_files: []
|
102
|
+
files:
|
103
|
+
- ChangeLog.rdoc
|
104
|
+
- Gemfile
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.rdoc
|
107
|
+
- Rakefile
|
108
|
+
- lib/simple-form-datepicker.rb
|
109
|
+
- lib/simple-form-datepicker/version.rb
|
110
|
+
- simple-form-datepicker.gemspec
|
111
|
+
- spec/datepicker_spec.rb
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
homepage: https://github.com/JasonBarnabe/simple-form-datepicker
|
114
|
+
licenses:
|
115
|
+
- MIT
|
116
|
+
metadata: {}
|
117
|
+
post_install_message:
|
118
|
+
rdoc_options: []
|
119
|
+
require_paths:
|
120
|
+
- lib
|
121
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
requirements:
|
128
|
+
- - ">="
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
version: '0'
|
131
|
+
requirements: []
|
132
|
+
rubyforge_project:
|
133
|
+
rubygems_version: 2.4.6
|
134
|
+
signing_key:
|
135
|
+
specification_version: 4
|
136
|
+
summary: Datepicker inputs for SimpleForm, updated for 3.1.0.
|
137
|
+
test_files:
|
138
|
+
- spec/datepicker_spec.rb
|
139
|
+
- spec/spec_helper.rb
|