bjornblomqvist-input_chronic 1.0.0 → 1.0.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.
data/README.rdoc CHANGED
@@ -18,6 +18,16 @@ provide a parameter 'date' or 'datetime'. The value will be
18
18
  parsed by Chronic and returned formatted as 2009-01-01 or
19
19
  2009-01-01 12:45, depending on the parameter name.
20
20
 
21
+ Don't forget to add the javascript found at
22
+
23
+ /javascript/input_chronic.js
24
+
25
+ This is also implemented by catching the request before it reaches rails.
26
+
27
+ To use this on a text input add the class chronic_date or chronic_datetime
28
+
29
+ <input type="text" class="chronic_datetime" />
30
+
21
31
  == Copyright
22
32
 
23
33
  Copyright (c) 2009 Erik Hansson, Bjorn Blomqvist. See LICENSE for details.
data/Rakefile CHANGED
@@ -9,7 +9,7 @@ begin
9
9
  gem.description = File.read(File.join(File.dirname(__FILE__), 'README.rdoc'))
10
10
  gem.email = "darwin.git@marianna.se"
11
11
  gem.homepage = "http://github.com/bjornblomqvist/input_chronic"
12
- gem.authors = ["Darwin"]
12
+ gem.authors = ["Erik Hansson","Bjorn Blomqvist"]
13
13
  gem.add_development_dependency "rspec"
14
14
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
15
15
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.0
1
+ 1.0.3
data/lib/input_chronic.rb CHANGED
@@ -19,26 +19,24 @@ class InputChronic
19
19
  if (jQuery) {
20
20
  $(document).ready(function() {
21
21
 
22
- $('input.date').live("change", function() {
23
- input = this;
24
- $.get('/gems.github.com/bjornblomqvist/input_chronic/parse', { date: this.value }, function(result) {
25
- $(input).removeClass("chronic_error")
22
+ function requestChronic(dateType,self) {
23
+ var params = {};
24
+ params[dateType] = self.value;
25
+ $.get('/gems.github.com/bjornblomqvist/input_chronic/parse', params, function(result) {
26
+ $(self).removeClass("chronic_error")
26
27
  if(result)
27
- input.value = result;
28
+ self.value = result;
28
29
  else
29
- $(input).addClass("chronic_error");
30
+ $(self).addClass("chronic_error");
30
31
  });
32
+ }
33
+
34
+ $('input.chronic_date').live("change", function() {
35
+ requestChronic(date,this);
31
36
  });
32
37
 
33
- $('input.datetime').live("change", function() {
34
- input = this;
35
- $.get('/gems.github.com/bjornblomqvist/input_chronic/parse', { datetime: this.value }, function(result) {
36
- $(input).removeClass("chronic_error")
37
- if(result)
38
- input.value = result;
39
- else
40
- $(input).addClass("chronic_error");
41
- });
38
+ $('input.chronic_datetime').live("change", function() {
39
+ requestChronic(datetime,this);
42
40
  });
43
41
 
44
42
  });
@@ -58,13 +56,13 @@ class InputChronic
58
56
  });
59
57
  }
60
58
 
61
- $$("input.date").each(function(input) {
59
+ $$("input.chronic_date").each(function(input) {
62
60
  input.observe('change', function() {
63
61
  checkDate(input, { date: this.value });
64
62
  });
65
63
  });
66
64
 
67
- $$("input.datetime").each(function(input) {
65
+ $$("input.chronic_datetime").each(function(input) {
68
66
  input.observe('change', function() {
69
67
  checkDate(input, { datetime: this.value });
70
68
  });
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bjornblomqvist-input_chronic
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
- - Darwin
7
+ - Erik Hansson
8
+ - Bjorn Blomqvist
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
12
 
12
- date: 2009-09-04 00:00:00 -07:00
13
+ date: 2009-09-07 00:00:00 -07:00
13
14
  default_executable:
14
15
  dependencies:
15
16
  - !ruby/object:Gem::Dependency
@@ -22,7 +23,7 @@ dependencies:
22
23
  - !ruby/object:Gem::Version
23
24
  version: "0"
24
25
  version:
25
- description: = input_chronic A simple Rack middleware that parses a dates using Chronic, and returns the result in a standardized manner. The idea is to use this to verify the input in date input fields using AJAX, to provide immediate feedback to the user. == Usage Include "input_chronic" in your middleware stack. In Rails, this is done in environment.rb config.gem 'bjornblomqvist-input_chronic', :lib => 'input_chronic', :source => 'http://gems.github.com' config.middleware.use "input_chronic" This will catch requests to /gems.github.com/bjornblomqvist/input_chronic. Use GET requests and provide a parameter 'date' or 'datetime'. The value will be parsed by Chronic and returned formatted as 2009-01-01 or 2009-01-01 12:45, depending on the parameter name. == Copyright Copyright (c) 2009 Erik Hansson, Bjorn Blomqvist. See LICENSE for details.
26
+ description: = input_chronic A simple Rack middleware that parses a dates using Chronic, and returns the result in a standardized manner. The idea is to use this to verify the input in date input fields using AJAX, to provide immediate feedback to the user. == Usage Include "input_chronic" in your middleware stack. In Rails, this is done in environment.rb config.gem 'bjornblomqvist-input_chronic', :lib => 'input_chronic', :source => 'http://gems.github.com' config.middleware.use "input_chronic" This will catch requests to /gems.github.com/bjornblomqvist/input_chronic. Use GET requests and provide a parameter 'date' or 'datetime'. The value will be parsed by Chronic and returned formatted as 2009-01-01 or 2009-01-01 12:45, depending on the parameter name. Don't forget to add the javascript found at /javascript/input_chronic.js This is also implemented by catching the request before it reaches rails. To use this on a text input add the class chronic_date or chronic_datetime <input type="text" class="chronic_datetime" /> == Copyright Copyright (c) 2009 Erik Hansson, Bjorn Blomqvist. See LICENSE for details.
26
27
  email: darwin.git@marianna.se
27
28
  executables: []
28
29
 
@@ -38,12 +39,12 @@ files:
38
39
  - README.rdoc
39
40
  - Rakefile
40
41
  - VERSION
41
- - input_chronic.gemspec
42
42
  - lib/input_chronic.rb
43
43
  - spec/input_chronic_spec.rb
44
44
  - spec/spec_helper.rb
45
45
  has_rdoc: true
46
46
  homepage: http://github.com/bjornblomqvist/input_chronic
47
+ licenses:
47
48
  post_install_message:
48
49
  rdoc_options:
49
50
  - --charset=UTF-8
@@ -64,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  requirements: []
65
66
 
66
67
  rubyforge_project:
67
- rubygems_version: 1.2.0
68
+ rubygems_version: 1.3.5
68
69
  signing_key:
69
70
  specification_version: 2
70
71
  summary: A simple Rack-middleware for parsing dates with Chronic
@@ -1,54 +0,0 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
- # -*- encoding: utf-8 -*-
5
-
6
- Gem::Specification.new do |s|
7
- s.name = %q{input_chronic}
8
- s.version = "1.0.0"
9
-
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Darwin"]
12
- s.date = %q{2009-09-04}
13
- s.description = %q{= input_chronic A simple Rack middleware that parses a dates using Chronic, and returns the result in a standardized manner. The idea is to use this to verify the input in date input fields using AJAX, to provide immediate feedback to the user. == Usage Include "input_chronic" in your middleware stack. In Rails, this is done in environment.rb config.gem 'bjornblomqvist-input_chronic', :lib => 'input_chronic', :source => 'http://gems.github.com' config.middleware.use "input_chronic" This will catch requests to /gems.github.com/bjornblomqvist/input_chronic. Use GET requests and provide a parameter 'date' or 'datetime'. The value will be parsed by Chronic and returned formatted as 2009-01-01 or 2009-01-01 12:45, depending on the parameter name. == Copyright Copyright (c) 2009 Erik Hansson, Bjorn Blomqvist. See LICENSE for details.}
14
- s.email = %q{darwin.git@marianna.se}
15
- s.extra_rdoc_files = [
16
- "LICENSE",
17
- "README.rdoc"
18
- ]
19
- s.files = [
20
- ".document",
21
- ".gitignore",
22
- "LICENSE",
23
- "README.rdoc",
24
- "Rakefile",
25
- "VERSION",
26
- "input_chronic.gemspec",
27
- "lib/input_chronic.rb",
28
- "spec/input_chronic_spec.rb",
29
- "spec/spec_helper.rb"
30
- ]
31
- s.has_rdoc = true
32
- s.homepage = %q{http://github.com/bjornblomqvist/input_chronic}
33
- s.rdoc_options = ["--charset=UTF-8"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.1}
36
- s.summary = %q{A simple Rack-middleware for parsing dates with Chronic}
37
- s.test_files = [
38
- "spec/input_chronic_spec.rb",
39
- "spec/spec_helper.rb"
40
- ]
41
-
42
- if s.respond_to? :specification_version then
43
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
44
- s.specification_version = 2
45
-
46
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
47
- s.add_development_dependency(%q<rspec>, [">= 0"])
48
- else
49
- s.add_dependency(%q<rspec>, [">= 0"])
50
- end
51
- else
52
- s.add_dependency(%q<rspec>, [">= 0"])
53
- end
54
- end