simple_form-jpmobile 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.rdoc +8 -0
- data/Rakefile +2 -0
- data/lib/simple_form-jpmobile.rb +62 -0
- data/lib/simple_form-jpmobile/version.rb +5 -0
- data/simple_form-jpmobile.gemspec +24 -0
- metadata +104 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Portions copyright (c) 2011 Mobalean LLC
|
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.
|
21
|
+
|
data/README.rdoc
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
module SimpleForm
|
2
|
+
module KeitaiInput
|
3
|
+
def mobile
|
4
|
+
@builder.template.request.mobile
|
5
|
+
end
|
6
|
+
|
7
|
+
def input
|
8
|
+
if mobile
|
9
|
+
if mobile.docomo?
|
10
|
+
input_html_options[:type] ||= "text"
|
11
|
+
input_html_options[:style] = %Q{-wap-input-format:"*<ja:#{docomo_wap_input_format}>"}
|
12
|
+
elsif mobile.au? || mobile.softbank?
|
13
|
+
input_html_options[:type] ||= "text"
|
14
|
+
input_html_options[:istyle] ||= istyle
|
15
|
+
input_html_options[:mode] ||= mode
|
16
|
+
input_html_options[:style] ||= %Q{-wap-input-format:*#{other_wap_input_format};}
|
17
|
+
end
|
18
|
+
end
|
19
|
+
super
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
|
24
|
+
class Inputs::HiraganaInput < Inputs::StringInput
|
25
|
+
include KeitaiInput
|
26
|
+
def docomo_wap_input_format; 'h'; end
|
27
|
+
def other_wap_input_format; 'M'; end
|
28
|
+
def mode; 'hiragana'; end
|
29
|
+
def istyle; '1'; end
|
30
|
+
end
|
31
|
+
|
32
|
+
class Inputs::HankakuKanaInput < Inputs::StringInput
|
33
|
+
include KeitaiInput
|
34
|
+
def docomo_wap_input_format; 'hk'; end
|
35
|
+
def other_wap_input_format; 'M'; end
|
36
|
+
def mode; 'hankakukana'; end
|
37
|
+
def istyle; '2'; end
|
38
|
+
end
|
39
|
+
|
40
|
+
class Inputs::AlphabetInput < Inputs::StringInput
|
41
|
+
include KeitaiInput
|
42
|
+
def docomo_wap_input_format; 'en'; end
|
43
|
+
def other_wap_input_format; 'm'; end
|
44
|
+
def mode; 'alphabet'; end
|
45
|
+
def istyle; '3'; end
|
46
|
+
end
|
47
|
+
|
48
|
+
class Inputs::KeitaiNumericInput < Inputs::NumericInput
|
49
|
+
include KeitaiInput
|
50
|
+
def docomo_wap_input_format; 'n'; end
|
51
|
+
def other_wap_input_format; 'N'; end
|
52
|
+
def mode; 'numeric'; end
|
53
|
+
def istyle; '4'; end
|
54
|
+
end
|
55
|
+
|
56
|
+
FormBuilder.class_eval do
|
57
|
+
map_type :integer, :decimal, :float, :to => Inputs::KeitaiNumericInput
|
58
|
+
end
|
59
|
+
|
60
|
+
module Jpmobile
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "simple_form-jpmobile/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "simple_form-jpmobile"
|
7
|
+
s.version = SimpleForm::Jpmobile::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Paul McMahon"]
|
10
|
+
s.email = ["paul@mobalean.com"]
|
11
|
+
s.homepage = ""
|
12
|
+
s.summary = %q{SimpleForm and Jpmobile integration}
|
13
|
+
s.description = %q{Keitai numeric imput modes on SimpleForm}
|
14
|
+
|
15
|
+
s.rubyforge_project = "simple_form-jpmobile"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency "simple_form", "~> 1.3.1"
|
23
|
+
s.add_dependency "jpmobile"
|
24
|
+
end
|
metadata
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: simple_form-jpmobile
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 29
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 1
|
10
|
+
version: 0.0.1
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Paul McMahon
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2011-02-09 00:00:00 +09:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: simple_form
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 25
|
30
|
+
segments:
|
31
|
+
- 1
|
32
|
+
- 3
|
33
|
+
- 1
|
34
|
+
version: 1.3.1
|
35
|
+
type: :runtime
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: jpmobile
|
39
|
+
prerelease: false
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 3
|
46
|
+
segments:
|
47
|
+
- 0
|
48
|
+
version: "0"
|
49
|
+
type: :runtime
|
50
|
+
version_requirements: *id002
|
51
|
+
description: Keitai numeric imput modes on SimpleForm
|
52
|
+
email:
|
53
|
+
- paul@mobalean.com
|
54
|
+
executables: []
|
55
|
+
|
56
|
+
extensions: []
|
57
|
+
|
58
|
+
extra_rdoc_files: []
|
59
|
+
|
60
|
+
files:
|
61
|
+
- .gitignore
|
62
|
+
- Gemfile
|
63
|
+
- LICENSE
|
64
|
+
- README.rdoc
|
65
|
+
- Rakefile
|
66
|
+
- lib/simple_form-jpmobile.rb
|
67
|
+
- lib/simple_form-jpmobile/version.rb
|
68
|
+
- simple_form-jpmobile.gemspec
|
69
|
+
has_rdoc: true
|
70
|
+
homepage: ""
|
71
|
+
licenses: []
|
72
|
+
|
73
|
+
post_install_message:
|
74
|
+
rdoc_options: []
|
75
|
+
|
76
|
+
require_paths:
|
77
|
+
- lib
|
78
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
79
|
+
none: false
|
80
|
+
requirements:
|
81
|
+
- - ">="
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
hash: 3
|
84
|
+
segments:
|
85
|
+
- 0
|
86
|
+
version: "0"
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
hash: 3
|
93
|
+
segments:
|
94
|
+
- 0
|
95
|
+
version: "0"
|
96
|
+
requirements: []
|
97
|
+
|
98
|
+
rubyforge_project: simple_form-jpmobile
|
99
|
+
rubygems_version: 1.3.7
|
100
|
+
signing_key:
|
101
|
+
specification_version: 3
|
102
|
+
summary: SimpleForm and Jpmobile integration
|
103
|
+
test_files: []
|
104
|
+
|