json_form_fields 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -16
- data/lib/json_form_fields/version.rb +1 -1
- metadata +3 -5
- data/vendor/assets/javascripts/json_form_fields.js +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbd0ce3d79a7a55957ea25312cc0f8cf179388a9
|
4
|
+
data.tar.gz: 3c6ae0013ebaee2d0d1f37a06efc848e82b056a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0c495e48cac620ec8d15b9b04a05567d3b2bfb9677614810595baee294dcf3ae509b7cb5bc121b332cdaf21ebb4442b191f245de5bd00251662b89eea35d523
|
7
|
+
data.tar.gz: 3c67d8206169b0471d19a2075ce6fe23b0e1f57f2e6a0f77ec6511a891991398e0e2e405770afaf5d4f7dcb2064b2507645b61e94a22f61e656301f271e28d7d
|
data/README.md
CHANGED
@@ -24,22 +24,7 @@ Or install it yourself as:
|
|
24
24
|
JsonFormFields::Generator.generate_inputs({ method: ["GET", "POST"] })
|
25
25
|
```
|
26
26
|
Will generate a select with GET and POST options. Works also with
|
27
|
-
password, email and
|
28
|
-
|
29
|
-
|
30
|
-
You also can use the javascript generator in a Rails app, just add this to your application.js
|
31
|
-
|
32
|
-
```javascript
|
33
|
-
//= require json_form_fields
|
34
|
-
```
|
35
|
-
|
36
|
-
And use as follows and the script will get the JSON from the content
|
37
|
-
of the input and will generate the inputs bellow:
|
38
|
-
|
39
|
-
```javascript
|
40
|
-
$('.your_input_id_or_class').json_form_fields();
|
41
|
-
|
42
|
-
```
|
27
|
+
password, email, text inputs and so on.
|
43
28
|
|
44
29
|
## Contributing
|
45
30
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json_form_fields
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Oliveira
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-04-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -66,7 +66,6 @@ files:
|
|
66
66
|
- lib/json_form_fields.rb
|
67
67
|
- lib/json_form_fields/generator.rb
|
68
68
|
- lib/json_form_fields/version.rb
|
69
|
-
- vendor/assets/javascripts/json_form_fields.js
|
70
69
|
homepage: https://github.com/Lucasosf/json_form_fields
|
71
70
|
licenses:
|
72
71
|
- MIT
|
@@ -87,9 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
86
|
version: '0'
|
88
87
|
requirements: []
|
89
88
|
rubyforge_project:
|
90
|
-
rubygems_version: 2.
|
89
|
+
rubygems_version: 2.4.5
|
91
90
|
signing_key:
|
92
91
|
specification_version: 4
|
93
92
|
summary: A gem to write form fields from JSON documents
|
94
93
|
test_files: []
|
95
|
-
has_rdoc:
|
@@ -1,17 +0,0 @@
|
|
1
|
-
|
2
|
-
$.fn.json_form_fields = function() {
|
3
|
-
json = $.parseJSON('['+ this.val() +']');
|
4
|
-
str = ''
|
5
|
-
|
6
|
-
for(var key in json){
|
7
|
-
if(json[key].constructor === Array){
|
8
|
-
str += '<select id="'+key+'">';
|
9
|
-
for(var option in json[key]){
|
10
|
-
str += '<option value="'+option+'">'+key+'</option>';
|
11
|
-
}
|
12
|
-
str += '</select>';
|
13
|
-
}else{
|
14
|
-
str += '<input type="text" id="'+key+'" value="'+json[key]+'">'
|
15
|
-
}
|
16
|
-
}
|
17
|
-
};
|