headmin 0.4.1 → 0.4.2
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.
- checksums.yaml +4 -4
- data/.lock-487e157d270f3062a98b7b2a012753708-1272821827 +0 -0
- data/CHANGELOG.md +8 -1
- data/Gemfile.lock +77 -79
- data/app/models/concerns/headmin/field.rb +4 -2
- data/app/models/concerns/headmin/fieldable.rb +138 -44
- data/app/views/headmin/forms/fields/_file.html.erb +1 -1
- data/app/views/headmin/forms/fields/_files.html.erb +17 -0
- data/lib/headmin/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -3
- data/app/views/headmin/forms/fields/_image.html.erb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2df34e0f6abc35cd855cab3059a40f7716b336df77abdbd4ea9609fc3cf6e5e
|
4
|
+
data.tar.gz: 2c2c5953560f608e6d479bcb7de506ce8da701be8d56b5fbf72cfcaf3a9478ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17a7d48956fb48e286cd0fd2ac043741256c2e573ffb024cc4ae7fffb2e39c54d4db380efb4308f6816649f43e3fde68fabda7d104211cbcdf8f387d6c7d384b
|
7
|
+
data.tar.gz: 33afd17085196473000927125f9186e5b5703575373cdee9be982e6ca32db31ce09aef1fdf3ebf65b2efb9e31b16595fb6b5076ea65e7872f2ecaf49f260ea12
|
File without changes
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
# Headmin Changelog
|
2
2
|
|
3
|
-
##
|
3
|
+
## 0.4.2
|
4
|
+
- FEATURE: New field type "files" to allow simple gallery creation
|
5
|
+
- FIX: Fields hash with duplicate keys no longer mix up
|
6
|
+
- BREAK: Image field is now deprecated. Use the file field instead
|
7
|
+
- BREAK: Field uses "has_many_attached :files" instead of "has_one_attache :file" now. Rename "file" to "files" in `active_storage_attachments`
|
8
|
+
- BREAK: You need to set a File object in the fields_hash, instead of creating an intermediate Blob instance
|
9
|
+
|
10
|
+
## 0.4
|
4
11
|
- FEATURE: Introduction of a `ViewModel` class to clean up the component views. This allows for a cleaner abstraction and better testing.
|
5
12
|
- FEATURE: New `wysiwyg` component which currently defaults to Redactor X. Redactor X will be swapped with a free open source version in the 1.0 release.
|
6
13
|
- FEATURE: `headmin/forms/redactorx` now accepts `hybrid: true` to hide the controls
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
headmin (0.4.
|
4
|
+
headmin (0.4.1)
|
5
5
|
closure_tree (~> 7.4)
|
6
6
|
inline_svg (~> 1.7)
|
7
7
|
redcarpet (~> 3.5)
|
@@ -10,67 +10,67 @@ PATH
|
|
10
10
|
GEM
|
11
11
|
remote: https://rubygems.org/
|
12
12
|
specs:
|
13
|
-
actioncable (7.0.
|
14
|
-
actionpack (= 7.0.
|
15
|
-
activesupport (= 7.0.
|
13
|
+
actioncable (7.0.2.4)
|
14
|
+
actionpack (= 7.0.2.4)
|
15
|
+
activesupport (= 7.0.2.4)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (7.0.
|
19
|
-
actionpack (= 7.0.
|
20
|
-
activejob (= 7.0.
|
21
|
-
activerecord (= 7.0.
|
22
|
-
activestorage (= 7.0.
|
23
|
-
activesupport (= 7.0.
|
18
|
+
actionmailbox (7.0.2.4)
|
19
|
+
actionpack (= 7.0.2.4)
|
20
|
+
activejob (= 7.0.2.4)
|
21
|
+
activerecord (= 7.0.2.4)
|
22
|
+
activestorage (= 7.0.2.4)
|
23
|
+
activesupport (= 7.0.2.4)
|
24
24
|
mail (>= 2.7.1)
|
25
25
|
net-imap
|
26
26
|
net-pop
|
27
27
|
net-smtp
|
28
|
-
actionmailer (7.0.
|
29
|
-
actionpack (= 7.0.
|
30
|
-
actionview (= 7.0.
|
31
|
-
activejob (= 7.0.
|
32
|
-
activesupport (= 7.0.
|
28
|
+
actionmailer (7.0.2.4)
|
29
|
+
actionpack (= 7.0.2.4)
|
30
|
+
actionview (= 7.0.2.4)
|
31
|
+
activejob (= 7.0.2.4)
|
32
|
+
activesupport (= 7.0.2.4)
|
33
33
|
mail (~> 2.5, >= 2.5.4)
|
34
34
|
net-imap
|
35
35
|
net-pop
|
36
36
|
net-smtp
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
|
-
actionpack (7.0.
|
39
|
-
actionview (= 7.0.
|
40
|
-
activesupport (= 7.0.
|
38
|
+
actionpack (7.0.2.4)
|
39
|
+
actionview (= 7.0.2.4)
|
40
|
+
activesupport (= 7.0.2.4)
|
41
41
|
rack (~> 2.0, >= 2.2.0)
|
42
42
|
rack-test (>= 0.6.3)
|
43
43
|
rails-dom-testing (~> 2.0)
|
44
44
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
45
|
-
actiontext (7.0.
|
46
|
-
actionpack (= 7.0.
|
47
|
-
activerecord (= 7.0.
|
48
|
-
activestorage (= 7.0.
|
49
|
-
activesupport (= 7.0.
|
45
|
+
actiontext (7.0.2.4)
|
46
|
+
actionpack (= 7.0.2.4)
|
47
|
+
activerecord (= 7.0.2.4)
|
48
|
+
activestorage (= 7.0.2.4)
|
49
|
+
activesupport (= 7.0.2.4)
|
50
50
|
globalid (>= 0.6.0)
|
51
51
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.0.
|
53
|
-
activesupport (= 7.0.
|
52
|
+
actionview (7.0.2.4)
|
53
|
+
activesupport (= 7.0.2.4)
|
54
54
|
builder (~> 3.1)
|
55
55
|
erubi (~> 1.4)
|
56
56
|
rails-dom-testing (~> 2.0)
|
57
57
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
58
|
-
activejob (7.0.
|
59
|
-
activesupport (= 7.0.
|
58
|
+
activejob (7.0.2.4)
|
59
|
+
activesupport (= 7.0.2.4)
|
60
60
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.0.
|
62
|
-
activesupport (= 7.0.
|
63
|
-
activerecord (7.0.
|
64
|
-
activemodel (= 7.0.
|
65
|
-
activesupport (= 7.0.
|
66
|
-
activestorage (7.0.
|
67
|
-
actionpack (= 7.0.
|
68
|
-
activejob (= 7.0.
|
69
|
-
activerecord (= 7.0.
|
70
|
-
activesupport (= 7.0.
|
61
|
+
activemodel (7.0.2.4)
|
62
|
+
activesupport (= 7.0.2.4)
|
63
|
+
activerecord (7.0.2.4)
|
64
|
+
activemodel (= 7.0.2.4)
|
65
|
+
activesupport (= 7.0.2.4)
|
66
|
+
activestorage (7.0.2.4)
|
67
|
+
actionpack (= 7.0.2.4)
|
68
|
+
activejob (= 7.0.2.4)
|
69
|
+
activerecord (= 7.0.2.4)
|
70
|
+
activesupport (= 7.0.2.4)
|
71
71
|
marcel (~> 1.0)
|
72
72
|
mini_mime (>= 1.1.0)
|
73
|
-
activesupport (7.0.
|
73
|
+
activesupport (7.0.2.4)
|
74
74
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
75
75
|
i18n (>= 1.6, < 2)
|
76
76
|
minitest (>= 5.1)
|
@@ -91,25 +91,24 @@ GEM
|
|
91
91
|
closure_tree (7.4.0)
|
92
92
|
activerecord (>= 4.2.10)
|
93
93
|
with_advisory_lock (>= 4.0.0)
|
94
|
-
concurrent-ruby (1.1.
|
94
|
+
concurrent-ruby (1.1.10)
|
95
95
|
crass (1.0.6)
|
96
|
-
debug (1.
|
96
|
+
debug (1.5.0)
|
97
97
|
irb (>= 1.3.6)
|
98
98
|
reline (>= 0.2.7)
|
99
99
|
digest (3.1.0)
|
100
100
|
erubi (1.10.0)
|
101
101
|
globalid (1.0.0)
|
102
102
|
activesupport (>= 5.0)
|
103
|
-
i18n (1.
|
103
|
+
i18n (1.10.0)
|
104
104
|
concurrent-ruby (~> 1.0)
|
105
105
|
inline_svg (1.8.0)
|
106
106
|
activesupport (>= 3.0)
|
107
107
|
nokogiri (>= 1.6)
|
108
108
|
io-console (0.5.11)
|
109
|
-
io-wait (0.2.1)
|
110
109
|
irb (1.4.1)
|
111
110
|
reline (>= 0.3.0)
|
112
|
-
loofah (2.
|
111
|
+
loofah (2.16.0)
|
113
112
|
crass (~> 1.0.2)
|
114
113
|
nokogiri (>= 1.5.9)
|
115
114
|
mail (2.7.1)
|
@@ -118,7 +117,7 @@ GEM
|
|
118
117
|
matrix (0.4.2)
|
119
118
|
method_source (1.0.0)
|
120
119
|
mini_mime (1.1.2)
|
121
|
-
minitest (5.
|
120
|
+
minitest (5.15.0)
|
122
121
|
minitest-spec-rails (6.1.0)
|
123
122
|
minitest (>= 5.0)
|
124
123
|
railties (>= 4.1)
|
@@ -130,78 +129,77 @@ GEM
|
|
130
129
|
digest
|
131
130
|
net-protocol
|
132
131
|
timeout
|
133
|
-
net-protocol (0.1.
|
134
|
-
io-wait
|
132
|
+
net-protocol (0.1.3)
|
135
133
|
timeout
|
136
134
|
net-smtp (0.3.1)
|
137
135
|
digest
|
138
136
|
net-protocol
|
139
137
|
timeout
|
140
138
|
nio4r (2.5.8)
|
141
|
-
nokogiri (1.13.
|
139
|
+
nokogiri (1.13.4-arm64-darwin)
|
142
140
|
racc (~> 1.4)
|
143
|
-
nokogiri (1.13.
|
141
|
+
nokogiri (1.13.4-x86_64-darwin)
|
144
142
|
racc (~> 1.4)
|
145
|
-
nokogiri (1.13.
|
143
|
+
nokogiri (1.13.4-x86_64-linux)
|
146
144
|
racc (~> 1.4)
|
147
|
-
parallel (1.
|
148
|
-
parser (3.1.
|
145
|
+
parallel (1.22.1)
|
146
|
+
parser (3.1.2.0)
|
149
147
|
ast (~> 2.4.1)
|
150
|
-
public_suffix (4.0.
|
148
|
+
public_suffix (4.0.7)
|
151
149
|
racc (1.6.0)
|
152
150
|
rack (2.2.3)
|
153
151
|
rack-test (1.1.0)
|
154
152
|
rack (>= 1.0, < 3)
|
155
|
-
rails (7.0.
|
156
|
-
actioncable (= 7.0.
|
157
|
-
actionmailbox (= 7.0.
|
158
|
-
actionmailer (= 7.0.
|
159
|
-
actionpack (= 7.0.
|
160
|
-
actiontext (= 7.0.
|
161
|
-
actionview (= 7.0.
|
162
|
-
activejob (= 7.0.
|
163
|
-
activemodel (= 7.0.
|
164
|
-
activerecord (= 7.0.
|
165
|
-
activestorage (= 7.0.
|
166
|
-
activesupport (= 7.0.
|
153
|
+
rails (7.0.2.4)
|
154
|
+
actioncable (= 7.0.2.4)
|
155
|
+
actionmailbox (= 7.0.2.4)
|
156
|
+
actionmailer (= 7.0.2.4)
|
157
|
+
actionpack (= 7.0.2.4)
|
158
|
+
actiontext (= 7.0.2.4)
|
159
|
+
actionview (= 7.0.2.4)
|
160
|
+
activejob (= 7.0.2.4)
|
161
|
+
activemodel (= 7.0.2.4)
|
162
|
+
activerecord (= 7.0.2.4)
|
163
|
+
activestorage (= 7.0.2.4)
|
164
|
+
activesupport (= 7.0.2.4)
|
167
165
|
bundler (>= 1.15.0)
|
168
|
-
railties (= 7.0.
|
166
|
+
railties (= 7.0.2.4)
|
169
167
|
rails-dom-testing (2.0.3)
|
170
168
|
activesupport (>= 4.2.0)
|
171
169
|
nokogiri (>= 1.6)
|
172
170
|
rails-html-sanitizer (1.4.2)
|
173
171
|
loofah (~> 2.3)
|
174
|
-
railties (7.0.
|
175
|
-
actionpack (= 7.0.
|
176
|
-
activesupport (= 7.0.
|
172
|
+
railties (7.0.2.4)
|
173
|
+
actionpack (= 7.0.2.4)
|
174
|
+
activesupport (= 7.0.2.4)
|
177
175
|
method_source
|
178
176
|
rake (>= 12.2)
|
179
177
|
thor (~> 1.0)
|
180
178
|
zeitwerk (~> 2.5)
|
181
179
|
rainbow (3.1.1)
|
182
|
-
rake (13.0.
|
180
|
+
rake (13.0.6)
|
183
181
|
redcarpet (3.5.1)
|
184
|
-
regexp_parser (2.
|
182
|
+
regexp_parser (2.3.1)
|
185
183
|
reline (0.3.1)
|
186
184
|
io-console (~> 0.5)
|
187
185
|
rexml (3.2.5)
|
188
186
|
rouge (3.28.0)
|
189
|
-
rubocop (1.
|
187
|
+
rubocop (1.28.2)
|
190
188
|
parallel (~> 1.10)
|
191
189
|
parser (>= 3.1.0.0)
|
192
190
|
rainbow (>= 2.2.2, < 4.0)
|
193
191
|
regexp_parser (>= 1.8, < 3.0)
|
194
192
|
rexml
|
195
|
-
rubocop-ast (>= 1.
|
193
|
+
rubocop-ast (>= 1.17.0, < 2.0)
|
196
194
|
ruby-progressbar (~> 1.7)
|
197
195
|
unicode-display_width (>= 1.4.0, < 3.0)
|
198
|
-
rubocop-ast (1.
|
199
|
-
parser (>= 3.
|
200
|
-
rubocop-performance (1.13.
|
196
|
+
rubocop-ast (1.17.0)
|
197
|
+
parser (>= 3.1.1.0)
|
198
|
+
rubocop-performance (1.13.3)
|
201
199
|
rubocop (>= 1.7.0, < 2.0)
|
202
200
|
rubocop-ast (>= 0.4.0)
|
203
201
|
ruby-progressbar (1.11.0)
|
204
|
-
sprockets (4.0.
|
202
|
+
sprockets (4.0.3)
|
205
203
|
concurrent-ruby (~> 1.0)
|
206
204
|
rack (> 1, < 3)
|
207
205
|
sprockets-rails (3.4.2)
|
@@ -209,9 +207,9 @@ GEM
|
|
209
207
|
activesupport (>= 5.2)
|
210
208
|
sprockets (>= 3.0.0)
|
211
209
|
sqlite3 (1.4.2)
|
212
|
-
standard (1.
|
213
|
-
rubocop (= 1.
|
214
|
-
rubocop-performance (= 1.13.
|
210
|
+
standard (1.11.0)
|
211
|
+
rubocop (= 1.28.2)
|
212
|
+
rubocop-performance (= 1.13.3)
|
215
213
|
strscan (3.0.1)
|
216
214
|
thor (1.2.1)
|
217
215
|
timeout (0.2.0)
|
@@ -11,8 +11,10 @@ module Headmin
|
|
11
11
|
belongs_to :field, optional: true, touch: true
|
12
12
|
has_many :fields, foreign_key: "parent_id"
|
13
13
|
accepts_nested_attributes_for :fields, allow_destroy: true
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
# field_type: :files, :file
|
16
|
+
has_many_attached :files
|
17
|
+
accepts_nested_attributes_for :files_attachments, allow_destroy: true
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -6,68 +6,162 @@ module Headmin
|
|
6
6
|
has_many :fields, as: :fieldable, dependent: :destroy
|
7
7
|
accepts_nested_attributes_for :fields, allow_destroy: true
|
8
8
|
|
9
|
+
# Callbacks
|
10
|
+
before_validation :build_fields
|
11
|
+
|
9
12
|
def fields_hash
|
10
|
-
|
11
|
-
parse_hash_tree(field.hash_tree)
|
12
|
-
end.reduce({}, :merge)
|
13
|
+
@fields_hash ||= parse_fields
|
13
14
|
end
|
14
15
|
|
15
16
|
def fields_hash=(hash)
|
16
|
-
|
17
|
+
@fields_hash = hash
|
17
18
|
end
|
18
19
|
|
19
20
|
private
|
20
21
|
|
21
|
-
def
|
22
|
+
def parse_fields
|
23
|
+
fields.where(parent: nil).order(position: :asc).map { |field| parse_hash_tree(field.hash_tree) }.reduce({}, :merge)
|
24
|
+
end
|
25
|
+
|
26
|
+
def build_fields
|
27
|
+
return unless @fields_hash
|
28
|
+
self.fields = fields_for(@fields_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
def fields_for(hash)
|
22
32
|
hash.map do |key, value|
|
23
33
|
case value
|
24
34
|
when Hash
|
25
|
-
|
26
|
-
name: key,
|
27
|
-
field_type: "group",
|
28
|
-
fields: parse_fields_hash(value)
|
29
|
-
)
|
35
|
+
field_for_hash(key, value)
|
30
36
|
when Array
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
fields: value.map do |item|
|
35
|
-
fields.new(name: "item", field_type: "group", fields: parse_fields_hash(item))
|
36
|
-
end
|
37
|
-
)
|
38
|
-
when String
|
39
|
-
fields.build(
|
40
|
-
name: key,
|
41
|
-
field_type: "text",
|
42
|
-
value: value
|
43
|
-
)
|
37
|
+
field_for_array(key, value)
|
38
|
+
when File
|
39
|
+
field_for_file(key, value)
|
44
40
|
else
|
45
|
-
|
46
|
-
name: key,
|
47
|
-
field_type: "file",
|
48
|
-
file: value
|
49
|
-
)
|
41
|
+
field_for_string(key, value)
|
50
42
|
end
|
51
43
|
end
|
52
44
|
end
|
53
45
|
|
46
|
+
def field_for_hash(name, hash)
|
47
|
+
::Field.new(
|
48
|
+
fieldable: self,
|
49
|
+
name: name,
|
50
|
+
field_type: "group",
|
51
|
+
fields: fields_for(hash)
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
def field_for_array(name, array)
|
56
|
+
if array.all? { |item| item.is_a?(File) }
|
57
|
+
field_for_files(name, array)
|
58
|
+
elsif array.all? { |item| item.is_a?(Hash) }
|
59
|
+
field_for_group_list(name, array)
|
60
|
+
else
|
61
|
+
field_for_simple_list(name, array)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
def field_for_simple_list(name, array)
|
66
|
+
::Field.new(
|
67
|
+
fieldable: self,
|
68
|
+
name: name,
|
69
|
+
field_type: "list",
|
70
|
+
fields: array.map { |item| fields_for({item: item}) }.flatten
|
71
|
+
)
|
72
|
+
end
|
73
|
+
|
74
|
+
def field_for_group_list(name, array)
|
75
|
+
::Field.new(
|
76
|
+
fieldable: self,
|
77
|
+
name: name,
|
78
|
+
field_type: "list",
|
79
|
+
fields: array.map { |item| ::Field.new(fieldable: self, name: "item", field_type: "group", fields: fields_for(item)) }
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
def field_for_string(name, string)
|
84
|
+
::Field.new(
|
85
|
+
fieldable: self,
|
86
|
+
name: name,
|
87
|
+
field_type: "text",
|
88
|
+
value: string
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
def field_for_file(name, file)
|
93
|
+
::Field.new(
|
94
|
+
fieldable: self,
|
95
|
+
name: name,
|
96
|
+
field_type: "file",
|
97
|
+
value: nil,
|
98
|
+
files: [ActiveStorage::Blob.create_and_upload!(
|
99
|
+
io: file,
|
100
|
+
filename: File.basename(file.path)
|
101
|
+
)]
|
102
|
+
)
|
103
|
+
end
|
104
|
+
|
105
|
+
def field_for_files(name, files)
|
106
|
+
::Field.new(
|
107
|
+
fieldable: self,
|
108
|
+
name: name,
|
109
|
+
field_type: "files",
|
110
|
+
value: nil,
|
111
|
+
files: files.map { |file|
|
112
|
+
ActiveStorage::Blob.create_and_upload!(
|
113
|
+
io: file,
|
114
|
+
filename: File.basename(file.path)
|
115
|
+
)
|
116
|
+
}
|
117
|
+
)
|
118
|
+
end
|
119
|
+
|
120
|
+
# From hash tree to hash
|
54
121
|
def parse_hash_tree(hash_tree)
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
122
|
+
new_hash = {}
|
123
|
+
hash_tree.each do |field, children|
|
124
|
+
new_hash[field.name.to_sym] = parse_field(field, children)
|
125
|
+
end
|
126
|
+
new_hash
|
127
|
+
end
|
128
|
+
|
129
|
+
# Parse value for given field
|
130
|
+
def parse_field(field, children)
|
131
|
+
case field.field_type.to_sym
|
132
|
+
when :group
|
133
|
+
parse_group_field(field, children)
|
134
|
+
when :list
|
135
|
+
parse_list_field(field, children)
|
136
|
+
when :files
|
137
|
+
parse_files_field(field)
|
138
|
+
when :file
|
139
|
+
parse_file_field(field)
|
140
|
+
else
|
141
|
+
parse_text_field(field)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
def parse_group_field(field, children)
|
146
|
+
parse_hash_tree(children)
|
147
|
+
end
|
148
|
+
|
149
|
+
def parse_list_field(field, children)
|
150
|
+
children.map do |child, grand_children|
|
151
|
+
parse_field(child, grand_children)
|
152
|
+
end
|
153
|
+
end
|
154
|
+
|
155
|
+
def parse_files_field(field)
|
156
|
+
field.files.all
|
157
|
+
end
|
158
|
+
|
159
|
+
def parse_file_field(field)
|
160
|
+
field.files.last
|
161
|
+
end
|
162
|
+
|
163
|
+
def parse_text_field(field)
|
164
|
+
field.value
|
71
165
|
end
|
72
166
|
end
|
73
167
|
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%
|
2
|
+
# name: headmin/forms/fields/file
|
3
|
+
#
|
4
|
+
# ==== Options
|
5
|
+
# * +form+ - Form object
|
6
|
+
# * +name+ - Name for the field
|
7
|
+
#
|
8
|
+
# ==== Examples
|
9
|
+
# Basic version
|
10
|
+
# <%= render 'headmin/forms/fields/file', form: group, name: :file do |field, attribute, label| %#>
|
11
|
+
# <%= render "headmin/forms/file", form: field, attribute: attribute, label: label %#>
|
12
|
+
# <% end %#>
|
13
|
+
%>
|
14
|
+
|
15
|
+
<%= render 'headmin/forms/fields/base', form: form, field_type: :files, name: name do |field, label| %>
|
16
|
+
<% yield field, :files, label %>
|
17
|
+
<% end %>
|
data/lib/headmin/version.rb
CHANGED
data/package.json
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: headmin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jef Vlamings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-04-
|
11
|
+
date: 2022-04-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: closure_tree
|
@@ -76,6 +76,7 @@ extra_rdoc_files: []
|
|
76
76
|
files:
|
77
77
|
- ".github/workflows/ci.yml"
|
78
78
|
- ".gitignore"
|
79
|
+
- ".lock-487e157d270f3062a98b7b2a012753708-1272821827"
|
79
80
|
- ".nvmrc"
|
80
81
|
- ".ruby-version"
|
81
82
|
- CHANGELOG.md
|
@@ -332,8 +333,8 @@ files:
|
|
332
333
|
- app/views/headmin/forms/autocomplete/_list.html.erb
|
333
334
|
- app/views/headmin/forms/fields/_base.html.erb
|
334
335
|
- app/views/headmin/forms/fields/_file.html.erb
|
336
|
+
- app/views/headmin/forms/fields/_files.html.erb
|
335
337
|
- app/views/headmin/forms/fields/_group.html.erb
|
336
|
-
- app/views/headmin/forms/fields/_image.html.erb
|
337
338
|
- app/views/headmin/forms/fields/_list.html.erb
|
338
339
|
- app/views/headmin/forms/fields/_text.html.erb
|
339
340
|
- app/views/headmin/forms/repeater/_row.html.erb
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<%
|
2
|
-
# name: headmin/forms/fields/image
|
3
|
-
#
|
4
|
-
# ==== Options
|
5
|
-
# * +form+ - Form object
|
6
|
-
# * +name+ - Name for the field
|
7
|
-
#
|
8
|
-
# ==== Examples
|
9
|
-
# Basic version
|
10
|
-
# <%= render 'headmin/forms/fields/image', form: group, name: :image do |field, attribute, label| %#>
|
11
|
-
# <%= render "headmin/forms/image", form: field, attribute: attribute, label: label %#>
|
12
|
-
# <% end %#>
|
13
|
-
%>
|
14
|
-
|
15
|
-
<%= render 'headmin/forms/fields/base', form: form, field_type: :image, name: name do |field, label| %>
|
16
|
-
<% yield field, :file, label %>
|
17
|
-
<% end %>
|