formtastic_date_as_string 0.0.1

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/.gitignore ADDED
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in formtastic_date_as_string.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "formtastic_date_as_string/version"
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = "formtastic_date_as_string"
7
+ s.version = FormtasticDateAsString::VERSION
8
+ s.platform = Gem::Platform::RUBY
9
+ s.authors = ["Dmitry Lihachev"]
10
+ s.email = ["lda@openteam.ru"]
11
+ s.homepage = "http://github.com/openteam/formtastic_date_as_string"
12
+ s.summary = %q{Creates input :as => :string for date firld}
13
+ s.description = %q{Creates input :as => :string for date field}
14
+
15
+ s.add_dependency "formtastic"
16
+
17
+ s.rubyforge_project = "formtastic_date_as_string"
18
+
19
+ s.files = `git ls-files`.split("\n")
20
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
21
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
22
+ s.require_paths = ["lib"]
23
+
24
+ end
@@ -0,0 +1,28 @@
1
+ module FormtasticDateAsString
2
+ # Your code goes here...
3
+ end
4
+
5
+
6
+ require 'formtastic'
7
+
8
+ Formtastic::SemanticFormBuilder.class_eval
9
+
10
+ def date_input(method, options = {})
11
+ value = @object.send(method)
12
+ options.merge! :as => :string
13
+ options.merge! :input_html => { :value => I18n.localize(value)} if value.is_a?(Date)
14
+ self.input(method, options).gsub(/class="string/, 'class="date')
15
+ end
16
+
17
+ def input_with_date(method, options={})
18
+ if !options[:as] && @object.is_a?(ActiveRecord::Base) &&
19
+ @object.column_for_attribute(method).try(:type) == :date
20
+ date_input(method, options)
21
+ else
22
+ input_without_date(method, options)
23
+ end
24
+ end
25
+
26
+ alias_method_chain :input, :date
27
+
28
+ end
@@ -0,0 +1,3 @@
1
+ module FormtasticDateAsString
2
+ VERSION = "0.0.1"
3
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: formtastic_date_as_string
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Dmitry Lihachev
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-24 00:00:00 +06:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: formtastic
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ description: Creates input :as => :string for date field
34
+ email:
35
+ - lda@openteam.ru
36
+ executables: []
37
+
38
+ extensions: []
39
+
40
+ extra_rdoc_files: []
41
+
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - Rakefile
46
+ - formtastic_date_as_string.gemspec
47
+ - lib/formtastic_date_as_string.rb
48
+ - lib/formtastic_date_as_string/version.rb
49
+ has_rdoc: true
50
+ homepage: http://github.com/openteam/formtastic_date_as_string
51
+ licenses: []
52
+
53
+ post_install_message:
54
+ rdoc_options: []
55
+
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ">="
62
+ - !ruby/object:Gem::Version
63
+ segments:
64
+ - 0
65
+ version: "0"
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ none: false
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ requirements: []
75
+
76
+ rubyforge_project: formtastic_date_as_string
77
+ rubygems_version: 1.3.7
78
+ signing_key:
79
+ specification_version: 3
80
+ summary: Creates input :as => :string for date firld
81
+ test_files: []
82
+