administrate-field-list 0.0.1 → 0.0.2
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 -1
- data/administrate-field-list.gemspec +1 -1
- data/app/views/fields/list/_form.html.erb +9 -12
- data/lib/administrate/field/list.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ff45d82552535f70bf04829c462a66d76b9318f
|
4
|
+
data.tar.gz: 86f6895c7ff9534925fc78d14f736962dab4dd57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c26cf0dad9ea3604b306ca7111b64c2a9004bf6429d1e1e275408a93fc70b21cc547092111453317d1338951ae0510f3392c7ab059605ec4383f42740e79a7e
|
7
|
+
data.tar.gz: 681a0f9f589774807e78c645d2831d24f25c4dd1e729eb70187293f4433c4a23fccc1ff33b2d127851125b8adaef4c6a9e402ad92bac140f9ebc88feb7795a9f
|
data/README.md
CHANGED
@@ -2,23 +2,24 @@
|
|
2
2
|
<%= f.label field.attribute %>
|
3
3
|
</div>
|
4
4
|
<div class="field-unit__field">
|
5
|
-
<%= f.hidden_field field.attribute %>
|
6
5
|
|
7
6
|
<% _group_id = "gid_#{SecureRandom.alphanumeric}" %>
|
8
|
-
<% field.values.each do |v| %>
|
9
7
|
|
8
|
+
<% field.values.each do |v| %>
|
10
9
|
<%= text_field_tag(
|
11
10
|
nil,
|
12
11
|
v,
|
12
|
+
name: "#{f.object_name}[#{field.attribute}][]",
|
13
13
|
class: _group_id,
|
14
14
|
)
|
15
15
|
%>
|
16
16
|
|
17
17
|
<% end %>
|
18
18
|
|
19
|
-
|
19
|
+
<% text_field_tag(
|
20
20
|
nil,
|
21
21
|
'',
|
22
|
+
name: "#{f.object_name}[#{field.attribute}][]",
|
22
23
|
class: _group_id,
|
23
24
|
)
|
24
25
|
%>
|
@@ -31,20 +32,16 @@
|
|
31
32
|
|
32
33
|
<script>
|
33
34
|
(function() {
|
34
|
-
var hiddens = document.querySelectorAll('input[type=hidden]');
|
35
|
-
var hidden = hiddens[hiddens.length - 1];
|
36
35
|
var group_selector = '.<%= _group_id %>'
|
36
|
+
var $f = $(group_selector).parents('form');
|
37
37
|
|
38
38
|
document.addEventListener("DOMContentLoaded", function(evt) {
|
39
39
|
|
40
|
-
var $f = $(hidden).parents('form');
|
41
40
|
$f.on('submit', function() {
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
$(hidden).val(JSON.stringify(vals));
|
41
|
+
// Filter empty fileds before submit
|
42
|
+
$(group_selector).filter(function() {
|
43
|
+
return !this.value;
|
44
|
+
}).removeAttr('name');
|
48
45
|
});
|
49
46
|
});
|
50
47
|
})()
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-list
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- potato2003
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-09
|
11
|
+
date: 2018-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|