headmin 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +6 -0
- data/Gemfile.lock +92 -90
- data/README.md +2 -2
- data/app/models/concerns/headmin/attachment.rb +34 -0
- data/app/models/headmin/form/media_view.rb +6 -2
- data/app/views/headmin/_filters.html.erb +2 -7
- data/app/views/headmin/_form.html.erb +1 -1
- data/app/views/headmin/_index.html.erb +1 -1
- data/app/views/headmin/forms/fields/_base.html.erb +1 -1
- data/app/views/headmin/layout/_content.html.erb +1 -1
- data/app/views/headmin/media/_media_item_modal.html.erb +26 -0
- data/app/views/headmin/nav/_item.html.erb +6 -1
- data/config/initializers/extend_active_storage_attachment.rb +3 -0
- data/config/locales/headmin/media/en.yml +1 -0
- data/config/locales/headmin/media/nl.yml +1 -0
- data/lib/headmin/version.rb +1 -1
- data/package.json +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f0d94377c6d3cf0d97bdffa08c34d9c95ef9b72036c8e7b1d0d1b89996ed52d
|
4
|
+
data.tar.gz: 9b263a38b16dacace7769f9eb2cab3b90dc478cc229fead7ae157c4fd48e7f65
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ee1ebb9dbc530154fd310c910dbab36e13272a0c3433b494588e6f552c5e8af6c6ee4f39b41f2737a7b2321805c02d9a5c22b7dfeea9c62455584ecc0cbc907
|
7
|
+
data.tar.gz: e88897ec516a9b4f83188f8eb12e1b49d46da547d03b459942da6f77266faee9031f0f3f06c5300529183e6f6cd9aa2112e92ce1b30ba7902edcd919b0f9ceaf
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
headmin (0.
|
4
|
+
headmin (0.6.0)
|
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.4)
|
14
|
-
actionpack (= 7.0.4)
|
15
|
-
activesupport (= 7.0.4)
|
13
|
+
actioncable (7.0.4.1)
|
14
|
+
actionpack (= 7.0.4.1)
|
15
|
+
activesupport (= 7.0.4.1)
|
16
16
|
nio4r (~> 2.0)
|
17
17
|
websocket-driver (>= 0.6.1)
|
18
|
-
actionmailbox (7.0.4)
|
19
|
-
actionpack (= 7.0.4)
|
20
|
-
activejob (= 7.0.4)
|
21
|
-
activerecord (= 7.0.4)
|
22
|
-
activestorage (= 7.0.4)
|
23
|
-
activesupport (= 7.0.4)
|
18
|
+
actionmailbox (7.0.4.1)
|
19
|
+
actionpack (= 7.0.4.1)
|
20
|
+
activejob (= 7.0.4.1)
|
21
|
+
activerecord (= 7.0.4.1)
|
22
|
+
activestorage (= 7.0.4.1)
|
23
|
+
activesupport (= 7.0.4.1)
|
24
24
|
mail (>= 2.7.1)
|
25
25
|
net-imap
|
26
26
|
net-pop
|
27
27
|
net-smtp
|
28
|
-
actionmailer (7.0.4)
|
29
|
-
actionpack (= 7.0.4)
|
30
|
-
actionview (= 7.0.4)
|
31
|
-
activejob (= 7.0.4)
|
32
|
-
activesupport (= 7.0.4)
|
28
|
+
actionmailer (7.0.4.1)
|
29
|
+
actionpack (= 7.0.4.1)
|
30
|
+
actionview (= 7.0.4.1)
|
31
|
+
activejob (= 7.0.4.1)
|
32
|
+
activesupport (= 7.0.4.1)
|
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.4)
|
39
|
-
actionview (= 7.0.4)
|
40
|
-
activesupport (= 7.0.4)
|
38
|
+
actionpack (7.0.4.1)
|
39
|
+
actionview (= 7.0.4.1)
|
40
|
+
activesupport (= 7.0.4.1)
|
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.4)
|
46
|
-
actionpack (= 7.0.4)
|
47
|
-
activerecord (= 7.0.4)
|
48
|
-
activestorage (= 7.0.4)
|
49
|
-
activesupport (= 7.0.4)
|
45
|
+
actiontext (7.0.4.1)
|
46
|
+
actionpack (= 7.0.4.1)
|
47
|
+
activerecord (= 7.0.4.1)
|
48
|
+
activestorage (= 7.0.4.1)
|
49
|
+
activesupport (= 7.0.4.1)
|
50
50
|
globalid (>= 0.6.0)
|
51
51
|
nokogiri (>= 1.8.5)
|
52
|
-
actionview (7.0.4)
|
53
|
-
activesupport (= 7.0.4)
|
52
|
+
actionview (7.0.4.1)
|
53
|
+
activesupport (= 7.0.4.1)
|
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.4)
|
59
|
-
activesupport (= 7.0.4)
|
58
|
+
activejob (7.0.4.1)
|
59
|
+
activesupport (= 7.0.4.1)
|
60
60
|
globalid (>= 0.3.6)
|
61
|
-
activemodel (7.0.4)
|
62
|
-
activesupport (= 7.0.4)
|
63
|
-
activerecord (7.0.4)
|
64
|
-
activemodel (= 7.0.4)
|
65
|
-
activesupport (= 7.0.4)
|
66
|
-
activestorage (7.0.4)
|
67
|
-
actionpack (= 7.0.4)
|
68
|
-
activejob (= 7.0.4)
|
69
|
-
activerecord (= 7.0.4)
|
70
|
-
activesupport (= 7.0.4)
|
61
|
+
activemodel (7.0.4.1)
|
62
|
+
activesupport (= 7.0.4.1)
|
63
|
+
activerecord (7.0.4.1)
|
64
|
+
activemodel (= 7.0.4.1)
|
65
|
+
activesupport (= 7.0.4.1)
|
66
|
+
activestorage (7.0.4.1)
|
67
|
+
actionpack (= 7.0.4.1)
|
68
|
+
activejob (= 7.0.4.1)
|
69
|
+
activerecord (= 7.0.4.1)
|
70
|
+
activesupport (= 7.0.4.1)
|
71
71
|
marcel (~> 1.0)
|
72
72
|
mini_mime (>= 1.1.0)
|
73
|
-
activesupport (7.0.4)
|
73
|
+
activesupport (7.0.4.1)
|
74
74
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
75
75
|
i18n (>= 1.6, < 2)
|
76
76
|
minitest (>= 5.1)
|
@@ -96,9 +96,10 @@ GEM
|
|
96
96
|
closure_tree (7.4.0)
|
97
97
|
activerecord (>= 4.2.10)
|
98
98
|
with_advisory_lock (>= 4.0.0)
|
99
|
-
concurrent-ruby (1.
|
99
|
+
concurrent-ruby (1.2.0)
|
100
100
|
crass (1.0.6)
|
101
|
-
|
101
|
+
date (3.3.3)
|
102
|
+
debug (1.7.1)
|
102
103
|
irb (>= 1.5.0)
|
103
104
|
reline (>= 0.3.1)
|
104
105
|
devise (4.8.1)
|
@@ -109,9 +110,9 @@ GEM
|
|
109
110
|
warden (~> 1.2.3)
|
110
111
|
enumerize (2.5.0)
|
111
112
|
activesupport (>= 3.2)
|
112
|
-
erubi (1.
|
113
|
+
erubi (1.12.0)
|
113
114
|
ffi (1.15.5)
|
114
|
-
globalid (1.0.
|
115
|
+
globalid (1.0.1)
|
115
116
|
activesupport (>= 5.0)
|
116
117
|
hotwire-rails (0.1.3)
|
117
118
|
rails (>= 6.0.0)
|
@@ -128,8 +129,8 @@ GEM
|
|
128
129
|
inline_svg (1.8.0)
|
129
130
|
activesupport (>= 3.0)
|
130
131
|
nokogiri (>= 1.6)
|
131
|
-
io-console (0.
|
132
|
-
irb (1.
|
132
|
+
io-console (0.6.0)
|
133
|
+
irb (1.6.2)
|
133
134
|
reline (>= 0.3.0)
|
134
135
|
json (2.6.3)
|
135
136
|
kaminari (1.2.2)
|
@@ -145,10 +146,10 @@ GEM
|
|
145
146
|
kaminari-core (= 1.2.2)
|
146
147
|
kaminari-core (1.2.2)
|
147
148
|
language_server-protocol (3.17.0.2)
|
148
|
-
loofah (2.19.
|
149
|
+
loofah (2.19.1)
|
149
150
|
crass (~> 1.0.2)
|
150
151
|
nokogiri (>= 1.5.9)
|
151
|
-
mail (2.8.0)
|
152
|
+
mail (2.8.0.1)
|
152
153
|
mini_mime (>= 0.1.1)
|
153
154
|
net-imap
|
154
155
|
net-pop
|
@@ -156,60 +157,61 @@ GEM
|
|
156
157
|
marcel (1.0.2)
|
157
158
|
matrix (0.4.2)
|
158
159
|
method_source (1.0.0)
|
159
|
-
mini_magick (4.
|
160
|
+
mini_magick (4.12.0)
|
160
161
|
mini_mime (1.1.2)
|
161
|
-
minitest (5.
|
162
|
+
minitest (5.17.0)
|
162
163
|
minitest-spec-rails (6.2.0)
|
163
164
|
minitest (>= 5.0)
|
164
165
|
railties (>= 4.1)
|
165
|
-
net-imap (0.3.
|
166
|
+
net-imap (0.3.4)
|
167
|
+
date
|
166
168
|
net-protocol
|
167
169
|
net-pop (0.1.2)
|
168
170
|
net-protocol
|
169
|
-
net-protocol (0.2.
|
171
|
+
net-protocol (0.2.1)
|
170
172
|
timeout
|
171
173
|
net-smtp (0.3.3)
|
172
174
|
net-protocol
|
173
175
|
nio4r (2.5.8)
|
174
|
-
nokogiri (1.
|
176
|
+
nokogiri (1.14.0-arm64-darwin)
|
175
177
|
racc (~> 1.4)
|
176
|
-
nokogiri (1.
|
178
|
+
nokogiri (1.14.0-x86_64-darwin)
|
177
179
|
racc (~> 1.4)
|
178
|
-
nokogiri (1.
|
180
|
+
nokogiri (1.14.0-x86_64-linux)
|
179
181
|
racc (~> 1.4)
|
180
182
|
orm_adapter (0.5.0)
|
181
183
|
parallel (1.22.1)
|
182
|
-
parser (3.
|
184
|
+
parser (3.2.0.0)
|
183
185
|
ast (~> 2.4.1)
|
184
|
-
public_suffix (5.0.
|
186
|
+
public_suffix (5.0.1)
|
185
187
|
puma (5.6.5)
|
186
188
|
nio4r (~> 2.0)
|
187
|
-
racc (1.6.
|
188
|
-
rack (2.2.
|
189
|
+
racc (1.6.2)
|
190
|
+
rack (2.2.6.2)
|
189
191
|
rack-test (2.0.2)
|
190
192
|
rack (>= 1.3)
|
191
|
-
rails (7.0.4)
|
192
|
-
actioncable (= 7.0.4)
|
193
|
-
actionmailbox (= 7.0.4)
|
194
|
-
actionmailer (= 7.0.4)
|
195
|
-
actionpack (= 7.0.4)
|
196
|
-
actiontext (= 7.0.4)
|
197
|
-
actionview (= 7.0.4)
|
198
|
-
activejob (= 7.0.4)
|
199
|
-
activemodel (= 7.0.4)
|
200
|
-
activerecord (= 7.0.4)
|
201
|
-
activestorage (= 7.0.4)
|
202
|
-
activesupport (= 7.0.4)
|
193
|
+
rails (7.0.4.1)
|
194
|
+
actioncable (= 7.0.4.1)
|
195
|
+
actionmailbox (= 7.0.4.1)
|
196
|
+
actionmailer (= 7.0.4.1)
|
197
|
+
actionpack (= 7.0.4.1)
|
198
|
+
actiontext (= 7.0.4.1)
|
199
|
+
actionview (= 7.0.4.1)
|
200
|
+
activejob (= 7.0.4.1)
|
201
|
+
activemodel (= 7.0.4.1)
|
202
|
+
activerecord (= 7.0.4.1)
|
203
|
+
activestorage (= 7.0.4.1)
|
204
|
+
activesupport (= 7.0.4.1)
|
203
205
|
bundler (>= 1.15.0)
|
204
|
-
railties (= 7.0.4)
|
206
|
+
railties (= 7.0.4.1)
|
205
207
|
rails-dom-testing (2.0.3)
|
206
208
|
activesupport (>= 4.2.0)
|
207
209
|
nokogiri (>= 1.6)
|
208
|
-
rails-html-sanitizer (1.
|
209
|
-
loofah (~> 2.
|
210
|
-
railties (7.0.4)
|
211
|
-
actionpack (= 7.0.4)
|
212
|
-
activesupport (= 7.0.4)
|
210
|
+
rails-html-sanitizer (1.5.0)
|
211
|
+
loofah (~> 2.19, >= 2.19.1)
|
212
|
+
railties (7.0.4.1)
|
213
|
+
actionpack (= 7.0.4.1)
|
214
|
+
activesupport (= 7.0.4.1)
|
213
215
|
method_source
|
214
216
|
rake (>= 12.2)
|
215
217
|
thor (~> 1.0)
|
@@ -217,8 +219,8 @@ GEM
|
|
217
219
|
rainbow (3.1.1)
|
218
220
|
rake (13.0.6)
|
219
221
|
redcarpet (3.5.1)
|
220
|
-
regexp_parser (2.6.
|
221
|
-
reline (0.3.
|
222
|
+
regexp_parser (2.6.2)
|
223
|
+
reline (0.3.2)
|
222
224
|
io-console (~> 0.5)
|
223
225
|
responders (3.0.1)
|
224
226
|
actionpack (>= 5.0)
|
@@ -229,19 +231,19 @@ GEM
|
|
229
231
|
actionpack (>= 5.2, < 7.1)
|
230
232
|
activesupport (>= 5.2, < 7.1)
|
231
233
|
addressable (~> 2.7)
|
232
|
-
rubocop (1.
|
234
|
+
rubocop (1.42.0)
|
233
235
|
json (~> 2.3)
|
234
236
|
parallel (~> 1.10)
|
235
237
|
parser (>= 3.1.2.1)
|
236
238
|
rainbow (>= 2.2.2, < 4.0)
|
237
239
|
regexp_parser (>= 1.8, < 3.0)
|
238
240
|
rexml (>= 3.2.5, < 4.0)
|
239
|
-
rubocop-ast (>= 1.
|
241
|
+
rubocop-ast (>= 1.24.1, < 2.0)
|
240
242
|
ruby-progressbar (~> 1.7)
|
241
243
|
unicode-display_width (>= 1.4.0, < 3.0)
|
242
|
-
rubocop-ast (1.24.
|
244
|
+
rubocop-ast (1.24.1)
|
243
245
|
parser (>= 3.1.1.0)
|
244
|
-
rubocop-performance (1.15.
|
246
|
+
rubocop-performance (1.15.2)
|
245
247
|
rubocop (>= 1.7.0, < 2.0)
|
246
248
|
rubocop-ast (>= 0.4.0)
|
247
249
|
ruby-progressbar (1.11.0)
|
@@ -255,20 +257,20 @@ GEM
|
|
255
257
|
sprockets (> 3.0)
|
256
258
|
sprockets-rails
|
257
259
|
tilt
|
258
|
-
sprockets (4.
|
260
|
+
sprockets (4.2.0)
|
259
261
|
concurrent-ruby (~> 1.0)
|
260
|
-
rack (
|
262
|
+
rack (>= 2.2.4, < 4)
|
261
263
|
sprockets-rails (3.4.2)
|
262
264
|
actionpack (>= 5.2)
|
263
265
|
activesupport (>= 5.2)
|
264
266
|
sprockets (>= 3.0.0)
|
265
|
-
sqlite3 (1.
|
266
|
-
sqlite3 (1.
|
267
|
-
sqlite3 (1.
|
268
|
-
standard (1.
|
267
|
+
sqlite3 (1.6.0-arm64-darwin)
|
268
|
+
sqlite3 (1.6.0-x86_64-darwin)
|
269
|
+
sqlite3 (1.6.0-x86_64-linux)
|
270
|
+
standard (1.22.1)
|
269
271
|
language_server-protocol (~> 3.17.0.2)
|
270
|
-
rubocop (= 1.
|
271
|
-
rubocop-performance (= 1.15.
|
272
|
+
rubocop (= 1.42.0)
|
273
|
+
rubocop-performance (= 1.15.2)
|
272
274
|
stimulus-rails (1.2.1)
|
273
275
|
railties (>= 6.0.0)
|
274
276
|
thor (1.2.1)
|
@@ -280,7 +282,7 @@ GEM
|
|
280
282
|
railties (>= 6.0.0)
|
281
283
|
tzinfo (2.0.5)
|
282
284
|
concurrent-ruby (~> 1.0)
|
283
|
-
unicode-display_width (2.
|
285
|
+
unicode-display_width (2.4.2)
|
284
286
|
warden (1.2.9)
|
285
287
|
rack (>= 2.0.9)
|
286
288
|
websocket-driver (0.7.5)
|
data/README.md
CHANGED
@@ -128,8 +128,8 @@ $ bundle
|
|
128
128
|
# Update the version number, push commits and tag the release
|
129
129
|
$ gem bump -v {patch,minor,major,...} --push --tag
|
130
130
|
|
131
|
-
# Release to Rubygems
|
132
|
-
$ gem release
|
131
|
+
# Release to Rubygems and create a Github release tag
|
132
|
+
$ gem release --github
|
133
133
|
```
|
134
134
|
|
135
135
|
Update the node package
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Headmin
|
2
|
+
module Attachment
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do
|
5
|
+
scope :not_a_variant, -> { where.not(record_type: "ActiveStorage::VariantRecord") }
|
6
|
+
|
7
|
+
def record_hierarchy
|
8
|
+
hierarchy = []
|
9
|
+
|
10
|
+
current = record
|
11
|
+
|
12
|
+
current, partial_hierarchy = process_fieldable(current)
|
13
|
+
hierarchy << partial_hierarchy if partial_hierarchy.present?
|
14
|
+
|
15
|
+
current, partial_hierarchy = process_blockable(current)
|
16
|
+
hierarchy << partial_hierarchy if partial_hierarchy.present?
|
17
|
+
|
18
|
+
hierarchy << current if current.present?
|
19
|
+
|
20
|
+
hierarchy.flatten
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def process_blockable(field)
|
26
|
+
field.respond_to?(:blockable) ? [field.blockable, field] : [field, nil]
|
27
|
+
end
|
28
|
+
|
29
|
+
def process_fieldable(field)
|
30
|
+
field.respond_to?(:fieldable) ? [field.root.fieldable, field.self_and_ancestors] : [field, nil]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -66,7 +66,9 @@ module Headmin
|
|
66
66
|
def association_object
|
67
67
|
if attached.is_a?(ActiveStorage::Attached::Many)
|
68
68
|
result = form.object.send(nested_attribute)
|
69
|
-
|
69
|
+
|
70
|
+
# We sort the collection with ruby to prevent a new query to be made that would dispose of the objects in memory
|
71
|
+
result = result.sort_by { |item| item.position } if sort
|
70
72
|
result
|
71
73
|
else
|
72
74
|
form.object.send(nested_attribute)
|
@@ -76,7 +78,9 @@ module Headmin
|
|
76
78
|
def attachments
|
77
79
|
if attached.is_a?(ActiveStorage::Attached::Many)
|
78
80
|
result = form.object.send(nested_attribute)
|
79
|
-
|
81
|
+
|
82
|
+
# We sort the collection with ruby to prevent a new query to be made that would dispose of the objects in memory
|
83
|
+
result = result.sort_by { |item| item.position } if sort
|
80
84
|
result.to_a.compact
|
81
85
|
else
|
82
86
|
[form.object.send(nested_attribute)].compact
|
@@ -14,15 +14,10 @@
|
|
14
14
|
# <%= render "headmin/filters", url: admin_polls_path %#>
|
15
15
|
|
16
16
|
action = local_assigns.has_key?(:url) ? url : request.path
|
17
|
-
|
18
|
-
begin
|
19
|
-
model = controller_name.classify.constantize
|
20
|
-
rescue
|
21
|
-
raise "Cannot find class!"
|
22
|
-
end
|
17
|
+
model = controller_name.classify.constantize rescue nil
|
23
18
|
%>
|
24
19
|
|
25
|
-
<%= form_with model: model
|
20
|
+
<%= form_with model: model&.new, url: action, method: :get, data: {controller: "filters", filters_target: "form"} do |form| %>
|
26
21
|
<%# Perform yield in order to capture content blocks, pass form so we can use headmin form inputs %>
|
27
22
|
<%= yield(form) %>
|
28
23
|
|
@@ -11,7 +11,6 @@
|
|
11
11
|
# <%= render "headmin/forms/fields/base", form: form, field_type: :text, name: name do |field, label| %#>
|
12
12
|
# <%= render "headmin/forms/text", form: field, attribute: :value, label: label %#>
|
13
13
|
# <% end %#>
|
14
|
-
|
15
14
|
field = form.object.fields.detect { |field| field.name.to_s == name.to_s }
|
16
15
|
field = field ? field : form.object.fields.new(field_type: field_type, name: name)
|
17
16
|
label = t("attributes.#{name.to_s.parameterize}", default: field.name.to_s)
|
@@ -21,5 +20,6 @@
|
|
21
20
|
<%= ff.hidden_field :id %>
|
22
21
|
<%= ff.hidden_field :name %>
|
23
22
|
<%= ff.hidden_field :field_type %>
|
23
|
+
|
24
24
|
<%= yield ff, label %>
|
25
25
|
<% end %>
|
@@ -42,6 +42,32 @@
|
|
42
42
|
<%= render "headmin/forms/text", form: form, attribute: :filename, append: "." + form.object.filename.to_s.rpartition(".").last, value: form.object.filename.to_s.rpartition(".").first %>
|
43
43
|
</div>
|
44
44
|
</div>
|
45
|
+
<% attachments = @blob.attachments.not_a_variant.all %>
|
46
|
+
<% if attachments.any? %>
|
47
|
+
<hr>
|
48
|
+
<h6><%= t(".attachment_used_by") %>:</h6>
|
49
|
+
<table class="table table-sm">
|
50
|
+
<tbody>
|
51
|
+
<% attachments.each do |attachment| %>
|
52
|
+
<% context_resource = attachment.record_hierarchy.last %>
|
53
|
+
<% context_resource_path = polymorphic_path([:admin, context_resource]) rescue nil %>
|
54
|
+
<tr>
|
55
|
+
<td width="40%">
|
56
|
+
<% if context_resource_path.present? %>
|
57
|
+
<%= link_to truncate(context_resource.to_s), context_resource_path, title: context_resource %>
|
58
|
+
<% else %>
|
59
|
+
<%= context_resource %>
|
60
|
+
<% end %>
|
61
|
+
</td>
|
62
|
+
<td width="25%"><%= "#{context_resource.model_name.human(count: 1)} (#{attachment.class.human_attribute_name(attachment.name.to_sym)})" %></td>
|
63
|
+
<td width="35%">
|
64
|
+
<small class="text-secondary"><%= l(attachment.created_at, format: :long) %></small>
|
65
|
+
</td>
|
66
|
+
</tr>
|
67
|
+
<% end %>
|
68
|
+
</tbody>
|
69
|
+
</table>
|
70
|
+
<% end %>
|
45
71
|
</div>
|
46
72
|
<div class="modal-footer">
|
47
73
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal"><%= t(".close") %></button>
|
@@ -5,6 +5,7 @@
|
|
5
5
|
# * +name</tt> - Name of the nav item
|
6
6
|
# * +url</tt> - URL for this nav item
|
7
7
|
# * +icon</tt> - Optional Bootstrap icon name
|
8
|
+
# * +locked</tt> - Item becomes unclickable and a lock icon appears at the end of the item
|
8
9
|
# * +active</tt> - Set to true if this nav item needs to be highlighted
|
9
10
|
#
|
10
11
|
# ==== Examples
|
@@ -17,14 +18,18 @@
|
|
17
18
|
name = local_assigns.has_key?(:name) ? name : ""
|
18
19
|
icon = local_assigns.has_key?(:icon) ? icon : nil
|
19
20
|
url = local_assigns.has_key?(:url) ? url : request.url
|
21
|
+
locked = local_assigns.has_key?(:locked) ? locked : false
|
20
22
|
active = local_assigns.has_key?(:active) ? active : current_url?(url)
|
21
23
|
%>
|
22
24
|
|
23
25
|
<li class="nav-item">
|
24
|
-
<a class="nav-link d-flex align-items-center <%= "active" if active %>" aria-current="page" href="<%= url %>">
|
26
|
+
<a class="nav-link d-flex align-items-center <%= "active" if active %> <%= "disabled" if locked %>" aria-current="page" href="<%= url %>">
|
25
27
|
<%= bootstrap_icon(icon, class: "me-2") if icon %>
|
26
28
|
<span class="d-block d-md-none d-lg-block">
|
27
29
|
<%= name %>
|
28
30
|
</span>
|
31
|
+
<% if locked %>
|
32
|
+
<%= bootstrap_icon("lock", class: "fs-6 ms-2") %>
|
33
|
+
<% end %>
|
29
34
|
</a>
|
30
35
|
</li>
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jef Vlamings
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: closure_tree
|
@@ -244,6 +244,7 @@ files:
|
|
244
244
|
- app/helpers/headmin/form_helper.rb
|
245
245
|
- app/helpers/headmin/notification_helper.rb
|
246
246
|
- app/helpers/headmin/request_helper.rb
|
247
|
+
- app/models/concerns/headmin/attachment.rb
|
247
248
|
- app/models/concerns/headmin/blob.rb
|
248
249
|
- app/models/concerns/headmin/block.rb
|
249
250
|
- app/models/concerns/headmin/blockable.rb
|
@@ -468,6 +469,7 @@ files:
|
|
468
469
|
- bin/setup
|
469
470
|
- config/importmap.rb
|
470
471
|
- config/initializers/customize_input_error.rb
|
472
|
+
- config/initializers/extend_active_storage_attachment.rb
|
471
473
|
- config/initializers/extend_active_storage_blob.rb
|
472
474
|
- config/locales/activerecord/en.yml
|
473
475
|
- config/locales/activerecord/nl.yml
|