administrate-field-active_storage 0.4.2 → 1.0.0
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/Gemfile.lock +31 -22
- data/README.md +4 -4
- data/administrate-field-active_storage.gemspec +1 -1
- data/app/views/fields/active_storage/_item.html.erb +6 -7
- data/app/views/fields/active_storage/_items.html.erb +0 -5
- data/contribute.md +1 -0
- data/test_app/Gemfile +2 -2
- data/test_app/Gemfile.lock +158 -93
- data/test_app/app/dashboards/post_dashboard.rb +4 -0
- data/test_app/app/models/post.rb +2 -0
- data/test_app/bin/setup +1 -1
- data/test_app/config/application.rb +6 -2
- data/test_app/config/environments/development.rb +9 -12
- data/test_app/config/environments/production.rb +31 -51
- data/test_app/config/environments/test.rb +13 -8
- data/test_app/config/initializers/assets.rb +0 -2
- data/test_app/config/initializers/content_security_policy.rb +21 -26
- data/test_app/config/initializers/filter_parameter_logging.rb +3 -1
- data/test_app/config/initializers/permissions_policy.rb +11 -9
- data/test_app/db/migrate/20231117220800_add_service_name_to_active_storage_blobs.active_storage.rb +22 -0
- data/test_app/db/migrate/20231117220801_create_active_storage_variant_records.active_storage.rb +27 -0
- data/test_app/db/migrate/20231117220802_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb +8 -0
- data/test_app/db/migrate/20231117224946_add_title_to_posts.rb +5 -0
- data/test_app/db/schema.rb +7 -7
- data/test_app/test/controllers/admin/posts_controller_test.rb +36 -0
- metadata +6 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 03bb904e84f812c143ffd299953296173301a72e1d26b897c835bb68581978c2
|
|
4
|
+
data.tar.gz: 88b1502b5b0f3a92d28c78e2e54621024dd3c3ff57b31ac2d53b496a9951ac43
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 35555e8d94b496e494c28f2f9c2fa24a70ee359dffb66181abf1cc079a95efd761ba0a513a4087f6db0fe0b5c7ebf3f2533a4eab5ff204c2d87d8d9bf9df7153
|
|
7
|
+
data.tar.gz: 814f250f4eaa7e5d5dbcf05f282daf0ae3ee3544419942ec16a42881905a32f478f4e09e1b1fadd735821e902229c045ce5ef8ce70d9616a071dc47045851aa0
|
data/Gemfile.lock
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
administrate-field-active_storage (0.
|
|
4
|
+
administrate-field-active_storage (0.4.1)
|
|
5
5
|
administrate (>= 0.2.2)
|
|
6
|
-
rails (>=
|
|
6
|
+
rails (>= 7.0)
|
|
7
7
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
@@ -67,26 +67,23 @@ GEM
|
|
|
67
67
|
i18n (>= 1.6, < 2)
|
|
68
68
|
minitest (>= 5.1)
|
|
69
69
|
tzinfo (~> 2.0)
|
|
70
|
-
administrate (0.
|
|
70
|
+
administrate (0.19.0)
|
|
71
71
|
actionpack (>= 5.0)
|
|
72
72
|
actionview (>= 5.0)
|
|
73
73
|
activerecord (>= 5.0)
|
|
74
|
-
datetime_picker_rails (~> 0.0.7)
|
|
75
74
|
jquery-rails (>= 4.0)
|
|
76
75
|
kaminari (>= 1.0)
|
|
77
|
-
momentjs-rails (~> 2.8)
|
|
78
76
|
sassc-rails (~> 2.1)
|
|
79
77
|
selectize-rails (~> 0.6)
|
|
80
78
|
ast (2.4.2)
|
|
81
79
|
builder (3.2.4)
|
|
82
80
|
concurrent-ruby (1.1.9)
|
|
83
81
|
crass (1.0.6)
|
|
84
|
-
|
|
85
|
-
momentjs-rails (>= 2.8.1)
|
|
82
|
+
date (3.3.4)
|
|
86
83
|
erubi (1.10.0)
|
|
87
|
-
ffi (1.
|
|
88
|
-
globalid (1.
|
|
89
|
-
activesupport (>=
|
|
84
|
+
ffi (1.16.3)
|
|
85
|
+
globalid (1.2.1)
|
|
86
|
+
activesupport (>= 6.1)
|
|
90
87
|
highline (2.0.3)
|
|
91
88
|
i18n (1.8.11)
|
|
92
89
|
concurrent-ruby (~> 1.0)
|
|
@@ -100,7 +97,7 @@ GEM
|
|
|
100
97
|
rails-i18n
|
|
101
98
|
rainbow (>= 2.2.2, < 4.0)
|
|
102
99
|
terminal-table (>= 1.5.1)
|
|
103
|
-
jquery-rails (4.
|
|
100
|
+
jquery-rails (4.6.0)
|
|
104
101
|
rails-dom-testing (>= 1, < 3)
|
|
105
102
|
railties (>= 4.2.0)
|
|
106
103
|
thor (>= 0.14, < 2.0)
|
|
@@ -119,18 +116,28 @@ GEM
|
|
|
119
116
|
loofah (2.13.0)
|
|
120
117
|
crass (~> 1.0.2)
|
|
121
118
|
nokogiri (>= 1.5.9)
|
|
122
|
-
mail (2.
|
|
119
|
+
mail (2.8.1)
|
|
123
120
|
mini_mime (>= 0.1.1)
|
|
121
|
+
net-imap
|
|
122
|
+
net-pop
|
|
123
|
+
net-smtp
|
|
124
124
|
marcel (1.0.2)
|
|
125
125
|
method_source (1.0.0)
|
|
126
|
-
mini_mime (1.1.
|
|
126
|
+
mini_mime (1.1.5)
|
|
127
|
+
mini_portile2 (2.8.5)
|
|
127
128
|
minitest (5.15.0)
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
129
|
+
net-imap (0.4.5)
|
|
130
|
+
date
|
|
131
|
+
net-protocol
|
|
132
|
+
net-pop (0.1.2)
|
|
133
|
+
net-protocol
|
|
134
|
+
net-protocol (0.2.2)
|
|
135
|
+
timeout
|
|
136
|
+
net-smtp (0.4.0)
|
|
137
|
+
net-protocol
|
|
138
|
+
nio4r (2.6.0)
|
|
139
|
+
nokogiri (1.13.3)
|
|
140
|
+
mini_portile2 (~> 2.8.0)
|
|
134
141
|
racc (~> 1.4)
|
|
135
142
|
parser (3.0.3.2)
|
|
136
143
|
ast (~> 2.4.1)
|
|
@@ -178,7 +185,7 @@ GEM
|
|
|
178
185
|
sprockets-rails
|
|
179
186
|
tilt
|
|
180
187
|
selectize-rails (0.12.6)
|
|
181
|
-
sprockets (4.
|
|
188
|
+
sprockets (4.1.1)
|
|
182
189
|
concurrent-ruby (~> 1.0)
|
|
183
190
|
rack (> 1, < 3)
|
|
184
191
|
sprockets-rails (3.4.2)
|
|
@@ -189,16 +196,18 @@ GEM
|
|
|
189
196
|
terminal-table (3.0.2)
|
|
190
197
|
unicode-display_width (>= 1.1.1, < 3)
|
|
191
198
|
thor (1.1.0)
|
|
192
|
-
tilt (2.0
|
|
199
|
+
tilt (2.3.0)
|
|
200
|
+
timeout (0.4.1)
|
|
193
201
|
tzinfo (2.0.4)
|
|
194
202
|
concurrent-ruby (~> 1.0)
|
|
195
203
|
unicode-display_width (2.1.0)
|
|
196
|
-
websocket-driver (0.7.
|
|
204
|
+
websocket-driver (0.7.6)
|
|
197
205
|
websocket-extensions (>= 0.1.0)
|
|
198
206
|
websocket-extensions (0.1.5)
|
|
199
207
|
zeitwerk (2.5.2)
|
|
200
208
|
|
|
201
209
|
PLATFORMS
|
|
210
|
+
arm64-darwin-21
|
|
202
211
|
x86_64-darwin-20
|
|
203
212
|
x86_64-linux
|
|
204
213
|
|
data/README.md
CHANGED
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
- To preview Office files as pictures you need to install [activestorage-office-previewer](https://github.com/basecamp/activestorage-office-previewer) by basecamp
|
|
9
9
|
|
|
10
10
|
## How To Use:
|
|
11
|
-
Add `administrate-field-active_storage` and `
|
|
11
|
+
Add `administrate-field-active_storage` and `image_processing` to your Gemfile (Rails 6+):
|
|
12
12
|
|
|
13
13
|
```ruby
|
|
14
|
-
gem
|
|
14
|
+
gem "administrate-field-active_storage"
|
|
15
15
|
gem "image_processing"
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
for
|
|
18
|
+
for Rails 5.x use the following
|
|
19
19
|
```ruby
|
|
20
|
-
gem
|
|
20
|
+
gem "administrate-field-active_storage", "0.1.8"
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Install:
|
|
@@ -2,7 +2,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
|
2
2
|
|
|
3
3
|
Gem::Specification.new do |gem|
|
|
4
4
|
gem.name = "administrate-field-active_storage"
|
|
5
|
-
gem.version = "0.
|
|
5
|
+
gem.version = "1.0.0"
|
|
6
6
|
gem.authors = ["Hamad AlGhanim"]
|
|
7
7
|
gem.email = ["hamadyalghanim@gmail.com"]
|
|
8
8
|
gem.homepage = "https://github.com/Dreamersoul/administrate-field-active_storage"
|
|
@@ -16,22 +16,21 @@ controlled via a boolean local variable.
|
|
|
16
16
|
A wrapper around the image url pulled from the database.
|
|
17
17
|
- `attachment`:
|
|
18
18
|
Reference to the file
|
|
19
|
-
- `removable`:
|
|
20
|
-
A boolean used to control the display of a `Remove` link which
|
|
21
|
-
is used to destroy a single attachment. Defaults to `false`
|
|
22
19
|
- `size`:
|
|
23
20
|
[x, y]
|
|
24
21
|
Maximum size of the ActiveStorage preview.
|
|
25
22
|
%>
|
|
26
|
-
<% if field.show_display_preview? %>
|
|
23
|
+
<% if field.show_display_preview? && attachment.persisted? %>
|
|
27
24
|
<div>
|
|
28
25
|
<%= render partial: 'fields/active_storage/preview', locals: local_assigns %>
|
|
29
26
|
</div>
|
|
30
27
|
<% end %>
|
|
31
28
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
<% if attachment.persisted? %>
|
|
30
|
+
<div>
|
|
31
|
+
<%= link_to attachment.filename, field.blob_url(attachment), title: attachment.filename %>
|
|
32
|
+
</div>
|
|
33
|
+
<% end %>
|
|
35
34
|
|
|
36
35
|
<% if field.destroy_url.present? %>
|
|
37
36
|
<% destroy_url = field.destroy_url.call(namespace, field.data.record, attachment) %>
|
|
@@ -8,9 +8,6 @@ This partial renders one or more attachments
|
|
|
8
8
|
- `field`:
|
|
9
9
|
An instance of [Administrate::Field::Image].
|
|
10
10
|
A wrapper around the image url pulled from the database.
|
|
11
|
-
- `removable`:
|
|
12
|
-
A boolean used to control the display of a `Remove` link which
|
|
13
|
-
is used to destroy a single attachment. Defaults to `false`
|
|
14
11
|
- `size`:
|
|
15
12
|
[x, y]
|
|
16
13
|
Maximum size of the ActiveStorage preview.
|
|
@@ -18,7 +15,6 @@ This partial renders one or more attachments
|
|
|
18
15
|
%>
|
|
19
16
|
|
|
20
17
|
<%
|
|
21
|
-
removable = local_assigns.fetch(:removable, false)
|
|
22
18
|
variant = local_assigns.fetch(:variant, field.show_preview_variant)
|
|
23
19
|
size = local_assigns.fetch(:size, field.show_preview_size)
|
|
24
20
|
%>
|
|
@@ -29,7 +25,6 @@ This partial renders one or more attachments
|
|
|
29
25
|
locals: {
|
|
30
26
|
field: field,
|
|
31
27
|
attachment: attachment,
|
|
32
|
-
removable: removable,
|
|
33
28
|
variant: variant,
|
|
34
29
|
size: size
|
|
35
30
|
} %>
|
data/contribute.md
CHANGED
data/test_app/Gemfile
CHANGED
|
@@ -4,7 +4,7 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
|
|
4
4
|
ruby '3.0.3'
|
|
5
5
|
|
|
6
6
|
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
|
7
|
-
gem 'rails'
|
|
7
|
+
gem 'rails', '7.1.2'
|
|
8
8
|
# Use sqlite3 as the database for Active Record
|
|
9
9
|
gem 'sqlite3', '~> 1.4'
|
|
10
10
|
# Use Puma as the app server
|
|
@@ -15,7 +15,7 @@ gem 'sass-rails', '>= 6'
|
|
|
15
15
|
# gem 'bcrypt', '~> 3.1.7'
|
|
16
16
|
|
|
17
17
|
# Use Active Storage variant
|
|
18
|
-
|
|
18
|
+
gem 'image_processing', '~> 1.2'
|
|
19
19
|
|
|
20
20
|
group :development, :test do
|
|
21
21
|
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
data/test_app/Gemfile.lock
CHANGED
|
@@ -8,64 +8,79 @@ PATH
|
|
|
8
8
|
GEM
|
|
9
9
|
remote: https://rubygems.org/
|
|
10
10
|
specs:
|
|
11
|
-
actioncable (7.
|
|
12
|
-
actionpack (= 7.
|
|
13
|
-
activesupport (= 7.
|
|
11
|
+
actioncable (7.1.2)
|
|
12
|
+
actionpack (= 7.1.2)
|
|
13
|
+
activesupport (= 7.1.2)
|
|
14
14
|
nio4r (~> 2.0)
|
|
15
15
|
websocket-driver (>= 0.6.1)
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
zeitwerk (~> 2.6)
|
|
17
|
+
actionmailbox (7.1.2)
|
|
18
|
+
actionpack (= 7.1.2)
|
|
19
|
+
activejob (= 7.1.2)
|
|
20
|
+
activerecord (= 7.1.2)
|
|
21
|
+
activestorage (= 7.1.2)
|
|
22
|
+
activesupport (= 7.1.2)
|
|
22
23
|
mail (>= 2.7.1)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
net-imap
|
|
25
|
+
net-pop
|
|
26
|
+
net-smtp
|
|
27
|
+
actionmailer (7.1.2)
|
|
28
|
+
actionpack (= 7.1.2)
|
|
29
|
+
actionview (= 7.1.2)
|
|
30
|
+
activejob (= 7.1.2)
|
|
31
|
+
activesupport (= 7.1.2)
|
|
28
32
|
mail (~> 2.5, >= 2.5.4)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
33
|
+
net-imap
|
|
34
|
+
net-pop
|
|
35
|
+
net-smtp
|
|
36
|
+
rails-dom-testing (~> 2.2)
|
|
37
|
+
actionpack (7.1.2)
|
|
38
|
+
actionview (= 7.1.2)
|
|
39
|
+
activesupport (= 7.1.2)
|
|
40
|
+
nokogiri (>= 1.8.5)
|
|
41
|
+
racc
|
|
42
|
+
rack (>= 2.2.4)
|
|
43
|
+
rack-session (>= 1.0.1)
|
|
34
44
|
rack-test (>= 0.6.3)
|
|
35
|
-
rails-dom-testing (~> 2.
|
|
36
|
-
rails-html-sanitizer (~> 1.
|
|
37
|
-
actiontext (7.
|
|
38
|
-
actionpack (= 7.
|
|
39
|
-
activerecord (= 7.
|
|
40
|
-
activestorage (= 7.
|
|
41
|
-
activesupport (= 7.
|
|
45
|
+
rails-dom-testing (~> 2.2)
|
|
46
|
+
rails-html-sanitizer (~> 1.6)
|
|
47
|
+
actiontext (7.1.2)
|
|
48
|
+
actionpack (= 7.1.2)
|
|
49
|
+
activerecord (= 7.1.2)
|
|
50
|
+
activestorage (= 7.1.2)
|
|
51
|
+
activesupport (= 7.1.2)
|
|
42
52
|
globalid (>= 0.6.0)
|
|
43
53
|
nokogiri (>= 1.8.5)
|
|
44
|
-
actionview (7.
|
|
45
|
-
activesupport (= 7.
|
|
54
|
+
actionview (7.1.2)
|
|
55
|
+
activesupport (= 7.1.2)
|
|
46
56
|
builder (~> 3.1)
|
|
47
|
-
erubi (~> 1.
|
|
48
|
-
rails-dom-testing (~> 2.
|
|
49
|
-
rails-html-sanitizer (~> 1.
|
|
50
|
-
activejob (7.
|
|
51
|
-
activesupport (= 7.
|
|
57
|
+
erubi (~> 1.11)
|
|
58
|
+
rails-dom-testing (~> 2.2)
|
|
59
|
+
rails-html-sanitizer (~> 1.6)
|
|
60
|
+
activejob (7.1.2)
|
|
61
|
+
activesupport (= 7.1.2)
|
|
52
62
|
globalid (>= 0.3.6)
|
|
53
|
-
activemodel (7.
|
|
54
|
-
activesupport (= 7.
|
|
55
|
-
activerecord (7.
|
|
56
|
-
activemodel (= 7.
|
|
57
|
-
activesupport (= 7.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
+
activemodel (7.1.2)
|
|
64
|
+
activesupport (= 7.1.2)
|
|
65
|
+
activerecord (7.1.2)
|
|
66
|
+
activemodel (= 7.1.2)
|
|
67
|
+
activesupport (= 7.1.2)
|
|
68
|
+
timeout (>= 0.4.0)
|
|
69
|
+
activestorage (7.1.2)
|
|
70
|
+
actionpack (= 7.1.2)
|
|
71
|
+
activejob (= 7.1.2)
|
|
72
|
+
activerecord (= 7.1.2)
|
|
73
|
+
activesupport (= 7.1.2)
|
|
63
74
|
marcel (~> 1.0)
|
|
64
|
-
|
|
65
|
-
|
|
75
|
+
activesupport (7.1.2)
|
|
76
|
+
base64
|
|
77
|
+
bigdecimal
|
|
66
78
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
79
|
+
connection_pool (>= 2.2.5)
|
|
80
|
+
drb
|
|
67
81
|
i18n (>= 1.6, < 2)
|
|
68
82
|
minitest (>= 5.1)
|
|
83
|
+
mutex_m
|
|
69
84
|
tzinfo (~> 2.0)
|
|
70
85
|
addressable (2.8.0)
|
|
71
86
|
public_suffix (>= 2.0.2, < 5.0)
|
|
@@ -79,6 +94,8 @@ GEM
|
|
|
79
94
|
momentjs-rails (~> 2.8)
|
|
80
95
|
sassc-rails (~> 2.1)
|
|
81
96
|
selectize-rails (~> 0.6)
|
|
97
|
+
base64 (0.2.0)
|
|
98
|
+
bigdecimal (3.1.4)
|
|
82
99
|
bindex (0.8.1)
|
|
83
100
|
builder (3.2.4)
|
|
84
101
|
byebug (11.1.3)
|
|
@@ -92,16 +109,27 @@ GEM
|
|
|
92
109
|
regexp_parser (>= 1.5, < 3.0)
|
|
93
110
|
xpath (~> 3.2)
|
|
94
111
|
childprocess (4.1.0)
|
|
95
|
-
concurrent-ruby (1.
|
|
112
|
+
concurrent-ruby (1.2.2)
|
|
113
|
+
connection_pool (2.4.1)
|
|
96
114
|
crass (1.0.6)
|
|
115
|
+
date (3.3.4)
|
|
97
116
|
datetime_picker_rails (0.0.7)
|
|
98
117
|
momentjs-rails (>= 2.8.1)
|
|
99
|
-
|
|
118
|
+
drb (2.2.0)
|
|
119
|
+
ruby2_keywords
|
|
120
|
+
erubi (1.12.0)
|
|
100
121
|
ffi (1.15.4)
|
|
101
|
-
globalid (1.
|
|
102
|
-
activesupport (>=
|
|
103
|
-
i18n (1.
|
|
122
|
+
globalid (1.2.1)
|
|
123
|
+
activesupport (>= 6.1)
|
|
124
|
+
i18n (1.14.1)
|
|
104
125
|
concurrent-ruby (~> 1.0)
|
|
126
|
+
image_processing (1.12.2)
|
|
127
|
+
mini_magick (>= 4.9.5, < 5)
|
|
128
|
+
ruby-vips (>= 2.0.17, < 3)
|
|
129
|
+
io-console (0.6.0)
|
|
130
|
+
irb (1.9.0)
|
|
131
|
+
rdoc
|
|
132
|
+
reline (>= 0.3.8)
|
|
105
133
|
jquery-rails (4.4.0)
|
|
106
134
|
rails-dom-testing (>= 1, < 3)
|
|
107
135
|
railties (>= 4.2.0)
|
|
@@ -118,61 +146,93 @@ GEM
|
|
|
118
146
|
activerecord
|
|
119
147
|
kaminari-core (= 1.2.2)
|
|
120
148
|
kaminari-core (1.2.2)
|
|
121
|
-
loofah (2.
|
|
149
|
+
loofah (2.22.0)
|
|
122
150
|
crass (~> 1.0.2)
|
|
123
|
-
nokogiri (>= 1.
|
|
124
|
-
mail (2.
|
|
151
|
+
nokogiri (>= 1.12.0)
|
|
152
|
+
mail (2.8.1)
|
|
125
153
|
mini_mime (>= 0.1.1)
|
|
154
|
+
net-imap
|
|
155
|
+
net-pop
|
|
156
|
+
net-smtp
|
|
126
157
|
marcel (1.0.2)
|
|
127
158
|
matrix (0.4.2)
|
|
128
|
-
|
|
129
|
-
mini_mime (1.1.
|
|
130
|
-
minitest (5.
|
|
159
|
+
mini_magick (4.12.0)
|
|
160
|
+
mini_mime (1.1.5)
|
|
161
|
+
minitest (5.20.0)
|
|
131
162
|
momentjs-rails (2.29.1)
|
|
132
163
|
railties (>= 3.1)
|
|
133
|
-
|
|
134
|
-
|
|
164
|
+
mutex_m (0.2.0)
|
|
165
|
+
net-imap (0.4.5)
|
|
166
|
+
date
|
|
167
|
+
net-protocol
|
|
168
|
+
net-pop (0.1.2)
|
|
169
|
+
net-protocol
|
|
170
|
+
net-protocol (0.2.2)
|
|
171
|
+
timeout
|
|
172
|
+
net-smtp (0.4.0)
|
|
173
|
+
net-protocol
|
|
174
|
+
nio4r (2.6.0)
|
|
175
|
+
nokogiri (1.15.5-arm64-darwin)
|
|
176
|
+
racc (~> 1.4)
|
|
177
|
+
nokogiri (1.15.5-x86_64-darwin)
|
|
135
178
|
racc (~> 1.4)
|
|
136
|
-
nokogiri (1.
|
|
179
|
+
nokogiri (1.15.5-x86_64-linux)
|
|
137
180
|
racc (~> 1.4)
|
|
181
|
+
psych (5.1.1.1)
|
|
182
|
+
stringio
|
|
138
183
|
public_suffix (4.0.6)
|
|
139
184
|
puma (5.6.4)
|
|
140
185
|
nio4r (~> 2.0)
|
|
141
|
-
racc (1.
|
|
142
|
-
rack (2.2.
|
|
186
|
+
racc (1.7.3)
|
|
187
|
+
rack (2.2.8)
|
|
143
188
|
rack-mini-profiler (2.3.3)
|
|
144
189
|
rack (>= 1.2.0)
|
|
145
|
-
rack-
|
|
146
|
-
rack (
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
190
|
+
rack-session (1.0.1)
|
|
191
|
+
rack (< 3)
|
|
192
|
+
rack-test (2.1.0)
|
|
193
|
+
rack (>= 1.3)
|
|
194
|
+
rackup (1.0.0)
|
|
195
|
+
rack (< 3)
|
|
196
|
+
webrick
|
|
197
|
+
rails (7.1.2)
|
|
198
|
+
actioncable (= 7.1.2)
|
|
199
|
+
actionmailbox (= 7.1.2)
|
|
200
|
+
actionmailer (= 7.1.2)
|
|
201
|
+
actionpack (= 7.1.2)
|
|
202
|
+
actiontext (= 7.1.2)
|
|
203
|
+
actionview (= 7.1.2)
|
|
204
|
+
activejob (= 7.1.2)
|
|
205
|
+
activemodel (= 7.1.2)
|
|
206
|
+
activerecord (= 7.1.2)
|
|
207
|
+
activestorage (= 7.1.2)
|
|
208
|
+
activesupport (= 7.1.2)
|
|
159
209
|
bundler (>= 1.15.0)
|
|
160
|
-
railties (= 7.
|
|
161
|
-
rails-dom-testing (2.0
|
|
162
|
-
activesupport (>=
|
|
210
|
+
railties (= 7.1.2)
|
|
211
|
+
rails-dom-testing (2.2.0)
|
|
212
|
+
activesupport (>= 5.0.0)
|
|
213
|
+
minitest
|
|
163
214
|
nokogiri (>= 1.6)
|
|
164
|
-
rails-html-sanitizer (1.
|
|
165
|
-
loofah (~> 2.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
215
|
+
rails-html-sanitizer (1.6.0)
|
|
216
|
+
loofah (~> 2.21)
|
|
217
|
+
nokogiri (~> 1.14)
|
|
218
|
+
railties (7.1.2)
|
|
219
|
+
actionpack (= 7.1.2)
|
|
220
|
+
activesupport (= 7.1.2)
|
|
221
|
+
irb
|
|
222
|
+
rackup (>= 1.0.0)
|
|
170
223
|
rake (>= 12.2)
|
|
171
|
-
thor (~> 1.0)
|
|
172
|
-
zeitwerk (~> 2.
|
|
173
|
-
rake (13.0
|
|
224
|
+
thor (~> 1.0, >= 1.2.2)
|
|
225
|
+
zeitwerk (~> 2.6)
|
|
226
|
+
rake (13.1.0)
|
|
227
|
+
rdoc (6.6.0)
|
|
228
|
+
psych (>= 4.0.0)
|
|
174
229
|
regexp_parser (2.2.0)
|
|
230
|
+
reline (0.4.0)
|
|
231
|
+
io-console (~> 0.5)
|
|
175
232
|
rexml (3.2.5)
|
|
233
|
+
ruby-vips (2.2.0)
|
|
234
|
+
ffi (~> 1.12)
|
|
235
|
+
ruby2_keywords (0.0.5)
|
|
176
236
|
rubyzip (2.3.2)
|
|
177
237
|
sass-rails (6.0.0)
|
|
178
238
|
sassc-rails (~> 2.1, >= 2.1.1)
|
|
@@ -197,23 +257,27 @@ GEM
|
|
|
197
257
|
activesupport (>= 5.2)
|
|
198
258
|
sprockets (>= 3.0.0)
|
|
199
259
|
sqlite3 (1.4.2)
|
|
200
|
-
|
|
260
|
+
stringio (3.0.9)
|
|
261
|
+
thor (1.3.0)
|
|
201
262
|
tilt (2.0.10)
|
|
202
|
-
|
|
263
|
+
timeout (0.4.1)
|
|
264
|
+
tzinfo (2.0.6)
|
|
203
265
|
concurrent-ruby (~> 1.0)
|
|
204
266
|
web-console (4.2.0)
|
|
205
267
|
actionview (>= 6.0.0)
|
|
206
268
|
activemodel (>= 6.0.0)
|
|
207
269
|
bindex (>= 0.4.0)
|
|
208
270
|
railties (>= 6.0.0)
|
|
209
|
-
|
|
271
|
+
webrick (1.8.1)
|
|
272
|
+
websocket-driver (0.7.6)
|
|
210
273
|
websocket-extensions (>= 0.1.0)
|
|
211
274
|
websocket-extensions (0.1.5)
|
|
212
275
|
xpath (3.2.0)
|
|
213
276
|
nokogiri (~> 1.8)
|
|
214
|
-
zeitwerk (2.
|
|
277
|
+
zeitwerk (2.6.12)
|
|
215
278
|
|
|
216
279
|
PLATFORMS
|
|
280
|
+
arm64-darwin-23
|
|
217
281
|
x86_64-darwin-20
|
|
218
282
|
x86_64-darwin-21
|
|
219
283
|
x86_64-linux
|
|
@@ -223,9 +287,10 @@ DEPENDENCIES
|
|
|
223
287
|
administrate-field-active_storage!
|
|
224
288
|
byebug
|
|
225
289
|
capybara (>= 3.26)
|
|
290
|
+
image_processing (~> 1.2)
|
|
226
291
|
puma (~> 5.6)
|
|
227
292
|
rack-mini-profiler (~> 2.0)
|
|
228
|
-
rails
|
|
293
|
+
rails (= 7.1.2)
|
|
229
294
|
sass-rails (>= 6)
|
|
230
295
|
selenium-webdriver
|
|
231
296
|
sqlite3 (~> 1.4)
|
|
@@ -236,4 +301,4 @@ RUBY VERSION
|
|
|
236
301
|
ruby 3.0.3p157
|
|
237
302
|
|
|
238
303
|
BUNDLED WITH
|
|
239
|
-
2.
|
|
304
|
+
2.4.22
|
|
@@ -10,6 +10,7 @@ class PostDashboard < Administrate::BaseDashboard
|
|
|
10
10
|
ATTRIBUTE_TYPES = {
|
|
11
11
|
id: Field::Number,
|
|
12
12
|
cover_image: Field::ActiveStorage,
|
|
13
|
+
title: Field::String,
|
|
13
14
|
created_at: Field::DateTime,
|
|
14
15
|
updated_at: Field::DateTime,
|
|
15
16
|
}.freeze
|
|
@@ -21,6 +22,7 @@ class PostDashboard < Administrate::BaseDashboard
|
|
|
21
22
|
# Feel free to add, remove, or rearrange items.
|
|
22
23
|
COLLECTION_ATTRIBUTES = %i[
|
|
23
24
|
id
|
|
25
|
+
title
|
|
24
26
|
cover_image
|
|
25
27
|
created_at
|
|
26
28
|
].freeze
|
|
@@ -29,6 +31,7 @@ class PostDashboard < Administrate::BaseDashboard
|
|
|
29
31
|
# an array of attributes that will be displayed on the model's show page.
|
|
30
32
|
SHOW_PAGE_ATTRIBUTES = %i[
|
|
31
33
|
id
|
|
34
|
+
title
|
|
32
35
|
cover_image
|
|
33
36
|
created_at
|
|
34
37
|
updated_at
|
|
@@ -38,6 +41,7 @@ class PostDashboard < Administrate::BaseDashboard
|
|
|
38
41
|
# an array of attributes that will be displayed
|
|
39
42
|
# on the model's form (`new` and `edit`) pages.
|
|
40
43
|
FORM_ATTRIBUTES = %i[
|
|
44
|
+
title
|
|
41
45
|
cover_image
|
|
42
46
|
].freeze
|
|
43
47
|
|
data/test_app/app/models/post.rb
CHANGED
data/test_app/bin/setup
CHANGED
|
@@ -12,7 +12,6 @@ require "action_controller/railtie"
|
|
|
12
12
|
require "action_text/engine"
|
|
13
13
|
require "action_view/railtie"
|
|
14
14
|
# require "action_cable/engine"
|
|
15
|
-
require "sprockets/railtie"
|
|
16
15
|
require "rails/test_unit/railtie"
|
|
17
16
|
|
|
18
17
|
# Require the gems listed in Gemfile, including any gems
|
|
@@ -22,7 +21,12 @@ Bundler.require(*Rails.groups)
|
|
|
22
21
|
module TestApp
|
|
23
22
|
class Application < Rails::Application
|
|
24
23
|
# Initialize configuration defaults for originally generated Rails version.
|
|
25
|
-
config.load_defaults
|
|
24
|
+
config.load_defaults 7.1
|
|
25
|
+
|
|
26
|
+
# Please, add to the `ignore` list any other `lib` subdirectories that do
|
|
27
|
+
# not contain `.rb` files, or that should not be reloaded or eager loaded.
|
|
28
|
+
# Common ones are `templates`, `generators`, or `middleware`, for example.
|
|
29
|
+
config.autoload_lib(ignore: %w(assets tasks))
|
|
26
30
|
|
|
27
31
|
# Configuration for the application, engines, and railties goes here.
|
|
28
32
|
#
|
|
@@ -6,7 +6,7 @@ Rails.application.configure do
|
|
|
6
6
|
# In the development environment your application's code is reloaded any time
|
|
7
7
|
# it changes. This slows down response time but is perfect for development
|
|
8
8
|
# since you don't have to restart the web server when you make code changes.
|
|
9
|
-
config.
|
|
9
|
+
config.enable_reloading = true
|
|
10
10
|
|
|
11
11
|
# Do not eager load code on boot.
|
|
12
12
|
config.eager_load = false
|
|
@@ -14,9 +14,12 @@ Rails.application.configure do
|
|
|
14
14
|
# Show full error reports.
|
|
15
15
|
config.consider_all_requests_local = true
|
|
16
16
|
|
|
17
|
+
# Enable server timing
|
|
18
|
+
config.server_timing = true
|
|
19
|
+
|
|
17
20
|
# Enable/disable caching. By default caching is disabled.
|
|
18
21
|
# Run rails dev:cache to toggle caching.
|
|
19
|
-
if Rails.root.join(
|
|
22
|
+
if Rails.root.join("tmp/caching-dev.txt").exist?
|
|
20
23
|
config.action_controller.perform_caching = true
|
|
21
24
|
config.action_controller.enable_fragment_cache_logging = true
|
|
22
25
|
|
|
@@ -48,10 +51,8 @@ Rails.application.configure do
|
|
|
48
51
|
# Highlight code that triggered database queries in logs.
|
|
49
52
|
config.active_record.verbose_query_logs = true
|
|
50
53
|
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
# number of complex assets.
|
|
54
|
-
config.assets.debug = true
|
|
54
|
+
# Highlight code that enqueued background job in logs.
|
|
55
|
+
config.active_job.verbose_enqueue_logs = true
|
|
55
56
|
|
|
56
57
|
# Suppress logger output for asset requests.
|
|
57
58
|
config.assets.quiet = true
|
|
@@ -62,10 +63,6 @@ Rails.application.configure do
|
|
|
62
63
|
# Annotate rendered view with file names.
|
|
63
64
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
64
65
|
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
|
68
|
-
|
|
69
|
-
# Uncomment if you wish to allow Action Cable access from any origin.
|
|
70
|
-
# config.action_cable.disable_request_forgery_protection = true
|
|
66
|
+
# Raise error when a before_action's only/except options reference missing actions
|
|
67
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
71
68
|
end
|
|
@@ -4,7 +4,7 @@ Rails.application.configure do
|
|
|
4
4
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
5
5
|
|
|
6
6
|
# Code is not reloaded between requests.
|
|
7
|
-
config.
|
|
7
|
+
config.enable_reloading = false
|
|
8
8
|
|
|
9
9
|
# Eager load code on boot. This eager loads most of Rails and
|
|
10
10
|
# your application in memory, allowing both threaded web servers
|
|
@@ -13,16 +13,15 @@ Rails.application.configure do
|
|
|
13
13
|
config.eager_load = true
|
|
14
14
|
|
|
15
15
|
# Full error reports are disabled and caching is turned on.
|
|
16
|
-
config.consider_all_requests_local
|
|
16
|
+
config.consider_all_requests_local = false
|
|
17
17
|
config.action_controller.perform_caching = true
|
|
18
18
|
|
|
19
|
-
# Ensures that a master key has been made available in
|
|
20
|
-
#
|
|
19
|
+
# Ensures that a master key has been made available in ENV["RAILS_MASTER_KEY"], config/master.key, or an environment
|
|
20
|
+
# key such as config/credentials/production.key. This key is used to decrypt credentials (and other encrypted files).
|
|
21
21
|
# config.require_master_key = true
|
|
22
22
|
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
|
23
|
+
# Enable static file serving from the `/public` folder (turn off if using NGINX/Apache for it).
|
|
24
|
+
config.public_file_server.enabled = true
|
|
26
25
|
|
|
27
26
|
# Compress CSS using a preprocessor.
|
|
28
27
|
# config.assets.css_compressor = :sass
|
|
@@ -40,67 +39,48 @@ Rails.application.configure do
|
|
|
40
39
|
# Store uploaded files on the local file system (see config/storage.yml for options).
|
|
41
40
|
config.active_storage.service = :local
|
|
42
41
|
|
|
42
|
+
# Assume all access to the app is happening through a SSL-terminating reverse proxy.
|
|
43
|
+
# Can be used together with config.force_ssl for Strict-Transport-Security and secure cookies.
|
|
44
|
+
# config.assume_ssl = true
|
|
45
|
+
|
|
43
46
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
|
44
47
|
# config.force_ssl = true
|
|
45
48
|
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
# Log to STDOUT by default
|
|
50
|
+
config.logger = ActiveSupport::Logger.new(STDOUT)
|
|
51
|
+
.tap { |logger| logger.formatter = ::Logger::Formatter.new }
|
|
52
|
+
.then { |logger| ActiveSupport::TaggedLogging.new(logger) }
|
|
49
53
|
|
|
50
54
|
# Prepend all log lines with the following tags.
|
|
51
55
|
config.log_tags = [ :request_id ]
|
|
52
56
|
|
|
57
|
+
# Info include generic and useful information about system operation, but avoids logging too much
|
|
58
|
+
# information to avoid inadvertent exposure of personally identifiable information (PII). If you
|
|
59
|
+
# want to log everything, set the level to "debug".
|
|
60
|
+
config.log_level = ENV.fetch("RAILS_LOG_LEVEL", "info")
|
|
61
|
+
|
|
53
62
|
# Use a different cache store in production.
|
|
54
63
|
# config.cache_store = :mem_cache_store
|
|
55
64
|
|
|
65
|
+
# Use a real queuing backend for Active Job (and separate queues per environment).
|
|
66
|
+
# config.active_job.queue_adapter = :resque
|
|
67
|
+
# config.active_job.queue_name_prefix = "test_app_production"
|
|
56
68
|
|
|
57
69
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
|
58
70
|
# the I18n.default_locale when a translation cannot be found).
|
|
59
71
|
config.i18n.fallbacks = true
|
|
60
72
|
|
|
61
|
-
#
|
|
62
|
-
config.active_support.
|
|
63
|
-
|
|
64
|
-
# Log disallowed deprecations.
|
|
65
|
-
config.active_support.disallowed_deprecation = :log
|
|
66
|
-
|
|
67
|
-
# Tell Active Support which deprecation messages to disallow.
|
|
68
|
-
config.active_support.disallowed_deprecation_warnings = []
|
|
69
|
-
|
|
70
|
-
# Use default logging formatter so that PID and timestamp are not suppressed.
|
|
71
|
-
config.log_formatter = ::Logger::Formatter.new
|
|
72
|
-
|
|
73
|
-
# Use a different logger for distributed setups.
|
|
74
|
-
# require "syslog/logger"
|
|
75
|
-
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
|
|
76
|
-
|
|
77
|
-
if ENV["RAILS_LOG_TO_STDOUT"].present?
|
|
78
|
-
logger = ActiveSupport::Logger.new(STDOUT)
|
|
79
|
-
logger.formatter = config.log_formatter
|
|
80
|
-
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
|
81
|
-
end
|
|
73
|
+
# Don't log any deprecations.
|
|
74
|
+
config.active_support.report_deprecations = false
|
|
82
75
|
|
|
83
76
|
# Do not dump schema after migrations.
|
|
84
77
|
config.active_record.dump_schema_after_migration = false
|
|
85
78
|
|
|
86
|
-
#
|
|
87
|
-
#
|
|
88
|
-
#
|
|
89
|
-
#
|
|
90
|
-
#
|
|
91
|
-
#
|
|
92
|
-
#
|
|
93
|
-
#
|
|
94
|
-
# The `database_resolver_context` class is used by the middleware to set
|
|
95
|
-
# timestamps for the last write to the primary. The resolver uses the context
|
|
96
|
-
# class timestamps to determine how long to wait before reading from the
|
|
97
|
-
# replica.
|
|
98
|
-
#
|
|
99
|
-
# By default Rails will store a last write timestamp in the session. The
|
|
100
|
-
# DatabaseSelector middleware is designed as such you can define your own
|
|
101
|
-
# strategy for connection switching and pass that into the middleware through
|
|
102
|
-
# these configuration options.
|
|
103
|
-
# config.active_record.database_selector = { delay: 2.seconds }
|
|
104
|
-
# config.active_record.database_resolver = ActiveRecord::Middleware::DatabaseSelector::Resolver
|
|
105
|
-
# config.active_record.database_resolver_context = ActiveRecord::Middleware::DatabaseSelector::Resolver::Session
|
|
79
|
+
# Enable DNS rebinding protection and other `Host` header attacks.
|
|
80
|
+
# config.hosts = [
|
|
81
|
+
# "example.com", # Allow requests from example.com
|
|
82
|
+
# /.*\.example\.com/ # Allow requests from subdomains like `www.example.com`
|
|
83
|
+
# ]
|
|
84
|
+
# Skip DNS rebinding protection for the default health check endpoint.
|
|
85
|
+
# config.host_authorization = { exclude: ->(request) { request.path == "/up" } }
|
|
106
86
|
end
|
|
@@ -8,12 +8,14 @@ require "active_support/core_ext/integer/time"
|
|
|
8
8
|
Rails.application.configure do
|
|
9
9
|
# Settings specified here will take precedence over those in config/application.rb.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
# While tests run files are not watched, reloading is not necessary.
|
|
12
|
+
config.enable_reloading = false
|
|
12
13
|
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
14
|
+
# Eager loading loads your entire application. When running a single test locally,
|
|
15
|
+
# this is usually not necessary, and can slow down your test suite. However, it's
|
|
16
|
+
# recommended that you enable it in continuous integration systems to ensure eager
|
|
17
|
+
# loading is working properly before deploying your code.
|
|
18
|
+
config.eager_load = ENV["CI"].present?
|
|
17
19
|
|
|
18
20
|
# Configure public file server for tests with Cache-Control for performance.
|
|
19
21
|
config.public_file_server.enabled = true
|
|
@@ -22,12 +24,12 @@ Rails.application.configure do
|
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
# Show full error reports and disable caching.
|
|
25
|
-
config.consider_all_requests_local
|
|
27
|
+
config.consider_all_requests_local = true
|
|
26
28
|
config.action_controller.perform_caching = false
|
|
27
29
|
config.cache_store = :null_store
|
|
28
30
|
|
|
29
|
-
#
|
|
30
|
-
config.action_dispatch.show_exceptions =
|
|
31
|
+
# Render exception templates for rescuable exceptions and raise for other exceptions.
|
|
32
|
+
config.action_dispatch.show_exceptions = :rescuable
|
|
31
33
|
|
|
32
34
|
# Disable request forgery protection in test environment.
|
|
33
35
|
config.action_controller.allow_forgery_protection = false
|
|
@@ -49,4 +51,7 @@ Rails.application.configure do
|
|
|
49
51
|
|
|
50
52
|
# Annotate rendered view with file names.
|
|
51
53
|
# config.action_view.annotate_rendered_view_with_filenames = true
|
|
54
|
+
|
|
55
|
+
# Raise error when a before_action's only/except options reference missing actions
|
|
56
|
+
config.action_controller.raise_on_missing_callback_actions = true
|
|
52
57
|
end
|
|
@@ -5,8 +5,6 @@ Rails.application.config.assets.version = '1.0'
|
|
|
5
5
|
|
|
6
6
|
# Add additional assets to the asset load path.
|
|
7
7
|
# Rails.application.config.assets.paths << Emoji.images_path
|
|
8
|
-
# Add Yarn node_modules folder to the asset load path.
|
|
9
|
-
Rails.application.config.assets.paths << Rails.root.join('node_modules')
|
|
10
8
|
|
|
11
9
|
# Precompile additional assets.
|
|
12
10
|
# application.js, application.css, and all non-JS/CSS in the app/assets
|
|
@@ -1,30 +1,25 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
|
-
# Define an application-wide content security policy
|
|
4
|
-
#
|
|
5
|
-
# https://
|
|
3
|
+
# Define an application-wide content security policy.
|
|
4
|
+
# See the Securing Rails Applications Guide for more information:
|
|
5
|
+
# https://guides.rubyonrails.org/security.html#content-security-policy-header
|
|
6
6
|
|
|
7
|
-
# Rails.application.
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
#
|
|
18
|
-
#
|
|
7
|
+
# Rails.application.configure do
|
|
8
|
+
# config.content_security_policy do |policy|
|
|
9
|
+
# policy.default_src :self, :https
|
|
10
|
+
# policy.font_src :self, :https, :data
|
|
11
|
+
# policy.img_src :self, :https, :data
|
|
12
|
+
# policy.object_src :none
|
|
13
|
+
# policy.script_src :self, :https
|
|
14
|
+
# policy.style_src :self, :https
|
|
15
|
+
# # Specify URI for violation reports
|
|
16
|
+
# # policy.report_uri "/csp-violation-report-endpoint"
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
|
|
20
|
+
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
|
|
21
|
+
# config.content_security_policy_nonce_directives = %w(script-src style-src)
|
|
22
|
+
#
|
|
23
|
+
# # Report violations without enforcing the policy.
|
|
24
|
+
# # config.content_security_policy_report_only = true
|
|
19
25
|
# end
|
|
20
|
-
|
|
21
|
-
# If you are using UJS then enable automatic nonce generation
|
|
22
|
-
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
|
23
|
-
|
|
24
|
-
# Set the nonce only to specific directives
|
|
25
|
-
# Rails.application.config.content_security_policy_nonce_directives = %w(script-src)
|
|
26
|
-
|
|
27
|
-
# Report CSP violations to a specified URI
|
|
28
|
-
# For further information see the following documentation:
|
|
29
|
-
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
|
30
|
-
# Rails.application.config.content_security_policy_report_only = true
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Be sure to restart your server when you modify this file.
|
|
2
2
|
|
|
3
|
-
# Configure
|
|
3
|
+
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
|
|
4
|
+
# Use this to limit dissemination of sensitive information.
|
|
5
|
+
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
|
|
4
6
|
Rails.application.config.filter_parameters += [
|
|
5
7
|
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
|
|
6
8
|
]
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
# Be sure to restart your server when you modify this file.
|
|
2
|
+
|
|
1
3
|
# Define an application-wide HTTP permissions policy. For further
|
|
2
|
-
# information see https://developers.google.com/web/updates/2018/06/feature-policy
|
|
3
|
-
|
|
4
|
-
# Rails.application.config.permissions_policy do |
|
|
5
|
-
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
4
|
+
# information see: https://developers.google.com/web/updates/2018/06/feature-policy
|
|
5
|
+
|
|
6
|
+
# Rails.application.config.permissions_policy do |policy|
|
|
7
|
+
# policy.camera :none
|
|
8
|
+
# policy.gyroscope :none
|
|
9
|
+
# policy.microphone :none
|
|
10
|
+
# policy.usb :none
|
|
11
|
+
# policy.fullscreen :self
|
|
12
|
+
# policy.payment :self, "https://secure.example.com"
|
|
11
13
|
# end
|
data/test_app/db/migrate/20231117220800_add_service_name_to_active_storage_blobs.active_storage.rb
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# This migration comes from active_storage (originally 20190112182829)
|
|
2
|
+
class AddServiceNameToActiveStorageBlobs < ActiveRecord::Migration[6.0]
|
|
3
|
+
def up
|
|
4
|
+
return unless table_exists?(:active_storage_blobs)
|
|
5
|
+
|
|
6
|
+
unless column_exists?(:active_storage_blobs, :service_name)
|
|
7
|
+
add_column :active_storage_blobs, :service_name, :string
|
|
8
|
+
|
|
9
|
+
if configured_service = ActiveStorage::Blob.service.name
|
|
10
|
+
ActiveStorage::Blob.unscoped.update_all(service_name: configured_service)
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
change_column :active_storage_blobs, :service_name, :string, null: false
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def down
|
|
18
|
+
return unless table_exists?(:active_storage_blobs)
|
|
19
|
+
|
|
20
|
+
remove_column :active_storage_blobs, :service_name
|
|
21
|
+
end
|
|
22
|
+
end
|
data/test_app/db/migrate/20231117220801_create_active_storage_variant_records.active_storage.rb
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# This migration comes from active_storage (originally 20191206030411)
|
|
2
|
+
class CreateActiveStorageVariantRecords < ActiveRecord::Migration[6.0]
|
|
3
|
+
def change
|
|
4
|
+
return unless table_exists?(:active_storage_blobs)
|
|
5
|
+
|
|
6
|
+
# Use Active Record's configured type for primary key
|
|
7
|
+
create_table :active_storage_variant_records, id: primary_key_type, if_not_exists: true do |t|
|
|
8
|
+
t.belongs_to :blob, null: false, index: false, type: blobs_primary_key_type
|
|
9
|
+
t.string :variation_digest, null: false
|
|
10
|
+
|
|
11
|
+
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
|
|
12
|
+
t.foreign_key :active_storage_blobs, column: :blob_id
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
private
|
|
17
|
+
def primary_key_type
|
|
18
|
+
config = Rails.configuration.generators
|
|
19
|
+
config.options[config.orm][:primary_key_type] || :primary_key
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def blobs_primary_key_type
|
|
23
|
+
pkey_name = connection.primary_key(:active_storage_blobs)
|
|
24
|
+
pkey_column = connection.columns(:active_storage_blobs).find { |c| c.name == pkey_name }
|
|
25
|
+
pkey_column.bigint? ? :bigint : pkey_column.type
|
|
26
|
+
end
|
|
27
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# This migration comes from active_storage (originally 20211119233751)
|
|
2
|
+
class RemoveNotNullOnActiveStorageBlobsChecksum < ActiveRecord::Migration[6.0]
|
|
3
|
+
def change
|
|
4
|
+
return unless table_exists?(:active_storage_blobs)
|
|
5
|
+
|
|
6
|
+
change_column_null(:active_storage_blobs, :checksum, true)
|
|
7
|
+
end
|
|
8
|
+
end
|
data/test_app/db/schema.rb
CHANGED
|
@@ -10,14 +10,13 @@
|
|
|
10
10
|
#
|
|
11
11
|
# It's strongly recommended that you check this file into your version control system.
|
|
12
12
|
|
|
13
|
-
ActiveRecord::Schema.define(version:
|
|
14
|
-
|
|
13
|
+
ActiveRecord::Schema.define(version: 2023_11_17_224946) do
|
|
15
14
|
create_table "active_storage_attachments", force: :cascade do |t|
|
|
16
15
|
t.string "name", null: false
|
|
17
16
|
t.string "record_type", null: false
|
|
18
17
|
t.integer "record_id", null: false
|
|
19
18
|
t.integer "blob_id", null: false
|
|
20
|
-
t.datetime "created_at", null: false
|
|
19
|
+
t.datetime "created_at", precision: nil, null: false
|
|
21
20
|
t.index ["blob_id"], name: "index_active_storage_attachments_on_blob_id"
|
|
22
21
|
t.index ["record_type", "record_id", "name", "blob_id"], name: "index_active_storage_attachments_uniqueness", unique: true
|
|
23
22
|
end
|
|
@@ -29,8 +28,8 @@ ActiveRecord::Schema.define(version: 2021_01_18_122927) do
|
|
|
29
28
|
t.text "metadata"
|
|
30
29
|
t.string "service_name", null: false
|
|
31
30
|
t.bigint "byte_size", null: false
|
|
32
|
-
t.string "checksum"
|
|
33
|
-
t.datetime "created_at", null: false
|
|
31
|
+
t.string "checksum"
|
|
32
|
+
t.datetime "created_at", precision: nil, null: false
|
|
34
33
|
t.index ["key"], name: "index_active_storage_blobs_on_key", unique: true
|
|
35
34
|
end
|
|
36
35
|
|
|
@@ -41,8 +40,9 @@ ActiveRecord::Schema.define(version: 2021_01_18_122927) do
|
|
|
41
40
|
end
|
|
42
41
|
|
|
43
42
|
create_table "posts", force: :cascade do |t|
|
|
44
|
-
t.
|
|
45
|
-
t.datetime "
|
|
43
|
+
t.string "title"
|
|
44
|
+
t.datetime "created_at", null: false
|
|
45
|
+
t.datetime "updated_at", null: false
|
|
46
46
|
end
|
|
47
47
|
|
|
48
48
|
add_foreign_key "active_storage_attachments", "active_storage_blobs", column: "blob_id"
|
|
@@ -10,5 +10,41 @@ module Admin
|
|
|
10
10
|
assert_response :ok
|
|
11
11
|
assert_select "td.cell-data--active-storage > a[href='#{admin_post_path(post)}']"
|
|
12
12
|
end
|
|
13
|
+
|
|
14
|
+
test "new" do
|
|
15
|
+
get new_admin_post_path
|
|
16
|
+
|
|
17
|
+
assert_response :ok
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
test "create with valid parameters increases Post count by 1" do
|
|
21
|
+
file = fixture_file_upload("cover_image.jpg")
|
|
22
|
+
|
|
23
|
+
assert_difference "Post.count", 1 do
|
|
24
|
+
post admin_posts_path, params: {
|
|
25
|
+
post: {
|
|
26
|
+
title: "New post title",
|
|
27
|
+
cover_image: file
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
assert_response :redirect
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
test "create with invalid parameters does not increase Post count" do
|
|
36
|
+
file = fixture_file_upload("cover_image.jpg")
|
|
37
|
+
|
|
38
|
+
assert_difference "Post.count", 0 do
|
|
39
|
+
post admin_posts_path, params: {
|
|
40
|
+
post: {
|
|
41
|
+
title: "",
|
|
42
|
+
cover_image: file
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
assert_response :unprocessable_entity
|
|
48
|
+
end
|
|
13
49
|
end
|
|
14
50
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: administrate-field-active_storage
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 1.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Hamad AlGhanim
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2023-
|
|
11
|
+
date: 2023-11-18 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: administrate
|
|
@@ -146,6 +146,10 @@ files:
|
|
|
146
146
|
- test_app/config/storage.yml
|
|
147
147
|
- test_app/db/migrate/20210118122804_create_active_storage_tables.active_storage.rb
|
|
148
148
|
- test_app/db/migrate/20210118122927_create_posts.rb
|
|
149
|
+
- test_app/db/migrate/20231117220800_add_service_name_to_active_storage_blobs.active_storage.rb
|
|
150
|
+
- test_app/db/migrate/20231117220801_create_active_storage_variant_records.active_storage.rb
|
|
151
|
+
- test_app/db/migrate/20231117220802_remove_not_null_on_active_storage_blobs_checksum.active_storage.rb
|
|
152
|
+
- test_app/db/migrate/20231117224946_add_title_to_posts.rb
|
|
149
153
|
- test_app/db/schema.rb
|
|
150
154
|
- test_app/db/seeds.rb
|
|
151
155
|
- test_app/lib/active_storage/fixture_set.rb
|