tessa 6.0.0.rc1 → 6.0.0.rc2
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/README.md +10 -16
- data/lib/tessa/simple_form/asset_input.rb +1 -1
- data/lib/tessa/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20d746d445cccc01d998f1d8bead8b92b8e0083e1858cd40ed2151785c1f4830
|
|
4
|
+
data.tar.gz: aa0432076ee14f238af2bf5cffdc83a0f37055246a1524ae2a05cb48e5bb3ed4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 386f143532a9e1a17b7149488d6d50d2affa444a3fc029653c5dca2218eef980df1963982cc64020b7aca85c7fbd7063e19a23fa0355cdebc4a0881230715585
|
|
7
|
+
data.tar.gz: f504a6ae2e98ee85478bb5d89ddb950533c80aa5a881f7accb336dfd36049eea8b1336c5a9f602ff6b51a4085826d76104475e3af9fdb8e17fdb0b7160a177f6
|
data/README.md
CHANGED
|
@@ -23,6 +23,12 @@ When that migration is completed, v2.x of this gem will remove all code that acc
|
|
|
23
23
|
will transition to being simply a convenience wrapper around ActiveStorage, so that we don't have to re-write as much
|
|
24
24
|
of our code in our frontend apps.
|
|
25
25
|
|
|
26
|
+
v6.x of this gem is compatible with ActiveStorage v6 and above. Since v6, ActiveStorage now does everything that this
|
|
27
|
+
gem used to do, with the exception of Dropzone integration. Therefore, tessa-client v6 only contains the following
|
|
28
|
+
two modules:
|
|
29
|
+
1. A set of Javascript utilities to integrate Dropzone.js with ActiveStorage direct uploads
|
|
30
|
+
2. A SimpleForm helper to write out the hidden input fields for an ActiveStorage `has_one_attached`.
|
|
31
|
+
|
|
26
32
|
## Installation
|
|
27
33
|
|
|
28
34
|
Add this line to your application's Gemfile:
|
|
@@ -61,17 +67,7 @@ from the user's browser.
|
|
|
61
67
|
|
|
62
68
|
To get all this working, follow these steps:
|
|
63
69
|
|
|
64
|
-
1.
|
|
65
|
-
in your `config/routes.rb`, `mount Tessa::Engine, at: '/'`. It's important that it is mounted at root.
|
|
66
|
-
|
|
67
|
-
You can use Authentication around the engine to prevent unauthorized uploads. With devise it's as simple as:
|
|
68
|
-
```rb
|
|
69
|
-
authenticated :user do
|
|
70
|
-
mount Tessa::Engine, at: '/'
|
|
71
|
-
end
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
2. In your application.js, require the js libraries:
|
|
70
|
+
1. In your application.js, require the js libraries:
|
|
75
71
|
```js
|
|
76
72
|
//= require dropzone
|
|
77
73
|
//= require tessa
|
|
@@ -79,16 +75,14 @@ You can use Authentication around the engine to prevent unauthorized uploads. W
|
|
|
79
75
|
Note that this only works if you are using Sprockets.
|
|
80
76
|
If you are using another bundler, we don't support that yet.
|
|
81
77
|
|
|
82
|
-
|
|
78
|
+
2. use ActiveStorage to add an attached asset
|
|
83
79
|
|
|
84
80
|
```rb
|
|
85
81
|
class Model < ApplicationRecord
|
|
86
|
-
include Tessa::Model
|
|
87
|
-
|
|
88
82
|
has_one_attached :image
|
|
89
83
|
```
|
|
90
84
|
|
|
91
|
-
|
|
85
|
+
3. When rendering your form, use the SimpleForm helper to render the dropzone div:
|
|
92
86
|
|
|
93
87
|
```erb
|
|
94
88
|
<%= f.input :image,
|
|
@@ -97,7 +91,7 @@ class Model < ApplicationRecord
|
|
|
97
91
|
hint: "Use an image that is 1440 x 288 in size (5:1 aspect ratio)" %>
|
|
98
92
|
```
|
|
99
93
|
|
|
100
|
-
|
|
94
|
+
4. Configure your ActiveStorage service to accept direct uploads.
|
|
101
95
|
The disk service does this automatically. The S3 service requires additional CORS configuration.
|
|
102
96
|
|
|
103
97
|
## Contributing
|
|
@@ -18,7 +18,7 @@ module Tessa
|
|
|
18
18
|
def hidden_fields_for(attribute_name)
|
|
19
19
|
asset = object.public_send(attribute_name)
|
|
20
20
|
unless asset&.key.present?
|
|
21
|
-
return @builder.hidden_field("#{attribute_name}")
|
|
21
|
+
return @builder.hidden_field("#{attribute_name}", value: nil)
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
@builder.hidden_field("#{attribute_name}",
|
data/lib/tessa/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tessa
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.0.0.
|
|
4
|
+
version: 6.0.0.rc2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Justin Powell
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2023-
|
|
12
|
+
date: 2023-05-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rake
|