formtastic-jquery_inputmask 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +13 -0
- data/.gitignore +4 -0
- data/.gitmodules +3 -0
- data/CONTRIBUTING.md +39 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +30 -0
- data/Rakefile +9 -0
- data/app/assets/javascripts/formtastic/inputmask.js +16 -0
- data/app/assets/javascripts/formtastic/inputmask/locales/pt-BR.js +74 -0
- data/formtastic-jquery_inputmask.gemspec +27 -0
- data/lib/formtastic/inputs/base/inputmask.rb +35 -0
- data/lib/formtastic/jquery_inputmask.rb +20 -0
- data/lib/formtastic/jquery_inputmask/engine.rb +9 -0
- data/lib/formtastic/jquery_inputmask/version.rb +10 -0
- metadata +171 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 5d7868a51903c885712e82e3a8081507b3c3e6a2
|
4
|
+
data.tar.gz: 775a6a09d83fb2a2e7332d8e2e067f44bd0f61a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ca65180e35b7f2c8f1fbf8fc914a480bf6387889459d99323b7462736782dae0a5b5fa105da41a98606a74dd4fe9ceb200d9bf6d6fd4f15820f6adc1ecbfaba2
|
7
|
+
data.tar.gz: 2a0572b2178db13985c9715c0a9a6047dc087d7a121637af15383c97c3432e8e4f4dd4f9ac461faa2b4f7912786fec40b1040cf0aeea51c6a6134762243fdba7
|
data/.editorconfig
ADDED
data/.gitignore
ADDED
data/.gitmodules
ADDED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
## Issues
|
4
|
+
|
5
|
+
If you want to request a feature or report a bug, please use the following template.
|
6
|
+
|
7
|
+
```markdown
|
8
|
+
## Description
|
9
|
+
|
10
|
+
[Add feature/bug description here]
|
11
|
+
|
12
|
+
## How to reproduce
|
13
|
+
|
14
|
+
[Add steps on how to reproduce this issue]
|
15
|
+
|
16
|
+
## What do you expect
|
17
|
+
|
18
|
+
[Describe what do you expect to happen]
|
19
|
+
|
20
|
+
## What happened instead
|
21
|
+
|
22
|
+
[Describe the actual results]
|
23
|
+
|
24
|
+
## Gem version:
|
25
|
+
|
26
|
+
Version: [Add gem version here]
|
27
|
+
```
|
28
|
+
|
29
|
+
## Writing code
|
30
|
+
|
31
|
+
Once you've made your great commits (include tests, please):
|
32
|
+
|
33
|
+
1. [Fork](http://help.github.com/forking/) the [original repository](http://github.com/dhyegofernando/formtastic-jquery_inputmask)
|
34
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
35
|
+
3. Push to your branch - `git push origin my_branch`
|
36
|
+
4. [Create an Issue](http://github.com/dhyegofernando/formtastic-jquery_inputmask/issues) with a link to your branch
|
37
|
+
5. That's it!
|
38
|
+
|
39
|
+
Please respect the code style using [editorconfig](http://editorconfig.org/) in your text editor.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Dhyego Fernando
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# Formtastic jQuery Inputmask
|
2
|
+
Easily add jquery inputmask to your Formtastic (or ActiveAdmin).
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
**1. Include to your Gemfile**
|
6
|
+
```ruby
|
7
|
+
gem 'formtastic-jquery_inputmask'
|
8
|
+
```
|
9
|
+
|
10
|
+
**2. Require javascript dependency**
|
11
|
+
```javascript
|
12
|
+
//= require formtastic/inputmask
|
13
|
+
```
|
14
|
+
|
15
|
+
**3. Load locale or other [inputmask](https://github.com/dhyegofernando/formtastic-jquery_inputmask/tree/master/vendor/Inputmask/dist) file as you want**
|
16
|
+
```javascript
|
17
|
+
//= require formtastic/inputmask/locales/pt-BR
|
18
|
+
//= require inputmask/phone-codes/phone-us
|
19
|
+
```
|
20
|
+
|
21
|
+
*p.s. it auto adds jquery as a dependency in your project*
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
```ruby
|
25
|
+
f.input :created_at, mask: 'datetime'
|
26
|
+
f.input :date, mask: { alias: 'datetime', inputformat: 'dd/mm/yyyy' }
|
27
|
+
```
|
28
|
+
|
29
|
+
## Maintainer
|
30
|
+
[Dhyego Fernando](https://github.com/dhyegofernando)
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
//= require jquery
|
2
|
+
//= require inputmask/inputmask
|
3
|
+
//= require inputmask/jquery.inputmask
|
4
|
+
//= require inputmask/inputmask.extensions
|
5
|
+
//= require inputmask/inputmask.date.extensions
|
6
|
+
//= require inputmask/inputmask.numeric.extensions
|
7
|
+
//= require inputmask/inputmask.phone.extensions
|
8
|
+
//= require inputmask/bindings/inputmask.binding
|
9
|
+
|
10
|
+
(function($) {
|
11
|
+
'use strict';
|
12
|
+
|
13
|
+
$(document).on('has_many_add:after', function(e, fieldset) {
|
14
|
+
$(fieldset).find('.inputmask').inputmask();
|
15
|
+
});
|
16
|
+
}(jQuery));
|
@@ -0,0 +1,74 @@
|
|
1
|
+
(function() {
|
2
|
+
'use strict';
|
3
|
+
|
4
|
+
Inputmask.extendAliases({
|
5
|
+
cpf: {
|
6
|
+
mask: '9{3}.9{3}.9{3}-9{2}'
|
7
|
+
},
|
8
|
+
cnpj: {
|
9
|
+
mask: '9{2}.9{3}.9{3}/9{4}-9{2}'
|
10
|
+
},
|
11
|
+
cpf_cnpj: {
|
12
|
+
mask: ['9{3}.9{3}.9{3}-9{2}', '9{2}.9{3}.9{3}/9{4}-9{2}']
|
13
|
+
},
|
14
|
+
cnpj_cpf: {
|
15
|
+
alias: 'cpf_cnpj'
|
16
|
+
},
|
17
|
+
phone: {
|
18
|
+
mask: ['(9{2}) 9{4}-9{4}', '(9{2}) 9{5}-9{4}']
|
19
|
+
},
|
20
|
+
cep: {
|
21
|
+
mask: '9{5}-9{3}'
|
22
|
+
},
|
23
|
+
zip_code: {
|
24
|
+
alias: 'cep'
|
25
|
+
},
|
26
|
+
postal_code: {
|
27
|
+
alias: 'cep'
|
28
|
+
},
|
29
|
+
currency: {
|
30
|
+
prefix: 'R$ ',
|
31
|
+
groupSeparator: '.',
|
32
|
+
radixPoint: ',',
|
33
|
+
alias: 'numeric',
|
34
|
+
placeholder: '0',
|
35
|
+
autoGroup: true,
|
36
|
+
digits: 2,
|
37
|
+
digitsOptional: false,
|
38
|
+
clearMaskOnLostFocus: false,
|
39
|
+
rightAlign: false,
|
40
|
+
numericInput: true
|
41
|
+
},
|
42
|
+
decimal: {
|
43
|
+
alias: 'numeric',
|
44
|
+
rightAlign: false
|
45
|
+
},
|
46
|
+
integer: {
|
47
|
+
alias: 'numeric',
|
48
|
+
digits: 0,
|
49
|
+
radixPoint: '',
|
50
|
+
rightAlign: false
|
51
|
+
},
|
52
|
+
percentage: {
|
53
|
+
alias: 'numeric',
|
54
|
+
digits: 2,
|
55
|
+
digitsOptional: true,
|
56
|
+
radixPoint: '.',
|
57
|
+
placeholder: '0',
|
58
|
+
autoGroup: false,
|
59
|
+
min: null,
|
60
|
+
max: null,
|
61
|
+
suffix: '%',
|
62
|
+
allowMinus: true,
|
63
|
+
rightAlign: false
|
64
|
+
},
|
65
|
+
date: {
|
66
|
+
alias: 'datetime',
|
67
|
+
inputFormat: 'dd/mm/yyyy'
|
68
|
+
},
|
69
|
+
shortDate: {
|
70
|
+
alias: 'datetime',
|
71
|
+
inputFormat: 'dd/mm/yy'
|
72
|
+
}
|
73
|
+
});
|
74
|
+
}());
|
@@ -0,0 +1,27 @@
|
|
1
|
+
$:.push File.expand_path('../lib', __FILE__)
|
2
|
+
|
3
|
+
require './lib/formtastic/jquery_inputmask/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'formtastic-jquery_inputmask'
|
7
|
+
spec.version = Formtastic::JqueryInputmask::Version::STRING
|
8
|
+
spec.authors = ['Dhyego Fernando']
|
9
|
+
spec.email = ['dhyegofernando@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Easily add jquery inputmask to your Formtastic.'
|
12
|
+
spec.description = spec.summary
|
13
|
+
spec.homepage = 'http://github.com/dhyegofernando/formtastic-jquery_inputmask'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
17
|
+
|
18
|
+
spec.add_dependency 'railties'
|
19
|
+
spec.add_dependency 'formtastic'
|
20
|
+
spec.add_dependency 'jquery-rails'
|
21
|
+
|
22
|
+
spec.add_development_dependency 'bundler'
|
23
|
+
spec.add_development_dependency 'rake'
|
24
|
+
spec.add_development_dependency 'minitest'
|
25
|
+
spec.add_development_dependency 'minitest-utils'
|
26
|
+
spec.add_development_dependency 'pry-meta'
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module Formtastic
|
2
|
+
module Inputs
|
3
|
+
module Base
|
4
|
+
module Inputmask
|
5
|
+
def input_html_options
|
6
|
+
super.tap do |options|
|
7
|
+
if self.options.fetch(:mask, nil)
|
8
|
+
options[:class] = [options[:class], 'inputmask'].compact.join(' ')
|
9
|
+
options[:data] ||= {}
|
10
|
+
options[:data].merge!(mask_options)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def mask_options
|
18
|
+
options = self.options.fetch(:mask)
|
19
|
+
|
20
|
+
options =
|
21
|
+
case options
|
22
|
+
when Hash
|
23
|
+
Hash[options.map { |k, v| [k.to_s.underscore.dasherize, v] }]
|
24
|
+
when String
|
25
|
+
{ alias: options }
|
26
|
+
else
|
27
|
+
raise "Expected Hash or String got #{options.class}"
|
28
|
+
end
|
29
|
+
|
30
|
+
Hash[options.map { |k, v| ["inputmask-#{k}", v] }]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'active_support/core_ext'
|
2
|
+
require 'formtastic'
|
3
|
+
|
4
|
+
module Formtastic
|
5
|
+
module JqueryInputmask
|
6
|
+
autoload :Version, 'formtastic/jquery_inputmask/version'
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'formtastic/jquery_inputmask/engine'
|
11
|
+
require 'formtastic/inputs/base/inputmask'
|
12
|
+
|
13
|
+
[
|
14
|
+
Formtastic::Inputs::DatalistInput,
|
15
|
+
Formtastic::Inputs::PhoneInput,
|
16
|
+
Formtastic::Inputs::SearchInput,
|
17
|
+
Formtastic::Inputs::StringInput,
|
18
|
+
Formtastic::Inputs::TextInput,
|
19
|
+
Formtastic::Inputs::UrlInput
|
20
|
+
].each { |klass| klass.include(Formtastic::Inputs::Base::Inputmask) }
|
metadata
ADDED
@@ -0,0 +1,171 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: formtastic-jquery_inputmask
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dhyego Fernando
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-10-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: railties
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: formtastic
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: jquery-rails
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: minitest-utils
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry-meta
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: Easily add jquery inputmask to your Formtastic.
|
126
|
+
email:
|
127
|
+
- dhyegofernando@gmail.com
|
128
|
+
executables: []
|
129
|
+
extensions: []
|
130
|
+
extra_rdoc_files: []
|
131
|
+
files:
|
132
|
+
- ".editorconfig"
|
133
|
+
- ".gitignore"
|
134
|
+
- ".gitmodules"
|
135
|
+
- CONTRIBUTING.md
|
136
|
+
- Gemfile
|
137
|
+
- LICENSE
|
138
|
+
- README.md
|
139
|
+
- Rakefile
|
140
|
+
- app/assets/javascripts/formtastic/inputmask.js
|
141
|
+
- app/assets/javascripts/formtastic/inputmask/locales/pt-BR.js
|
142
|
+
- formtastic-jquery_inputmask.gemspec
|
143
|
+
- lib/formtastic/inputs/base/inputmask.rb
|
144
|
+
- lib/formtastic/jquery_inputmask.rb
|
145
|
+
- lib/formtastic/jquery_inputmask/engine.rb
|
146
|
+
- lib/formtastic/jquery_inputmask/version.rb
|
147
|
+
homepage: http://github.com/dhyegofernando/formtastic-jquery_inputmask
|
148
|
+
licenses:
|
149
|
+
- MIT
|
150
|
+
metadata: {}
|
151
|
+
post_install_message:
|
152
|
+
rdoc_options: []
|
153
|
+
require_paths:
|
154
|
+
- lib
|
155
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - ">="
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
requirements: []
|
166
|
+
rubyforge_project:
|
167
|
+
rubygems_version: 2.4.8
|
168
|
+
signing_key:
|
169
|
+
specification_version: 4
|
170
|
+
summary: Easily add jquery inputmask to your Formtastic.
|
171
|
+
test_files: []
|