solidus_product_attachments 0.0.6 → 0.0.7
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/LICENSE +1 -1
- data/README.md +2 -2
- data/Rakefile +1 -0
- data/app/models/spree/attachment.rb +2 -1
- data/lib/solidus_product_attachments/testing_support/factories/attachments.rb +4 -0
- data/lib/solidus_product_attachments/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a0932818f16b360d1e236aee75e547c0729902feb224057dbaed9d942606607a
|
|
4
|
+
data.tar.gz: 20d2eb504ea123cd5dd2282961a6e69a4519bef5bf6b51655fb67e59200ff2ce
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5e3b7a1a208419ed487dd176852d022a3e5f25455af98ec10382b9f69047fb07c85bfce5a5d611cc225a723a3c3c88493022d83bc11e52e10c70952348d264b8
|
|
7
|
+
data.tar.gz: fcc9cb99f3f9dabf5537209268fe7156301cd7a2e426194dacf1b473844e02b8781ece63da5466d98390264e4de4720cdc0fcb3544f7935423822039a7241a99
|
data/LICENSE
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Solidus Product Attachments
|
|
2
2
|
|
|
3
|
-
This Solidus extension allows the administrator to upload
|
|
3
|
+
This Solidus extension allows the administrator to upload files to a product or to a variant.
|
|
4
4
|
|
|
5
5
|
[](https://semaphoreci.com/renuo/solidus_product_attachments)
|
|
6
6
|
[](https://badge.fury.io/rb/solidus_product_attachments)
|
|
@@ -71,4 +71,4 @@ require 'solidus_product_attachments/testing_support/factories'
|
|
|
71
71
|
|
|
72
72
|
## Copyright
|
|
73
73
|
|
|
74
|
-
Copyright (c)
|
|
74
|
+
Copyright (c) 2024 [Renuo AG](https://www.renuo.ch/en), released under the New BSD License.
|
data/Rakefile
CHANGED
|
@@ -3,13 +3,14 @@ module Spree
|
|
|
3
3
|
ATTACHMENT_ATTRIBUTES = %i[alt attachment_content_type attachment_file_name
|
|
4
4
|
attachment_updated_at id position type].freeze
|
|
5
5
|
PERMITTED_ATTACHMENT_ATTRIBUTES = %i[alt attachment position viewable_id viewable_type].freeze
|
|
6
|
+
ALLOWED_CONTENT_TYPES = %w[application/pdf text/plain].freeze
|
|
6
7
|
|
|
7
8
|
has_attached_file :attachment,
|
|
8
9
|
url: '/spree/attachments/:id/:basename.:extension',
|
|
9
10
|
path: 'spree/attachments/:id/:basename.:extension'
|
|
10
11
|
|
|
11
12
|
validate :no_attachment_errors
|
|
12
|
-
validates_attachment :attachment, content_type: { content_type:
|
|
13
|
+
validates_attachment :attachment, content_type: { content_type: ALLOWED_CONTENT_TYPES }
|
|
13
14
|
|
|
14
15
|
def no_attachment_errors
|
|
15
16
|
errors.add :attachment, "Paperclip returned errors for file #{attachment_file_name}" if attachment.errors.any?
|
|
@@ -3,5 +3,9 @@ require_relative '../support/assets'
|
|
|
3
3
|
FactoryBot.define do
|
|
4
4
|
factory :attachment, class: Spree::Attachment do
|
|
5
5
|
attachment { fake_attachment }
|
|
6
|
+
|
|
7
|
+
trait :txt do
|
|
8
|
+
attachment { Rack::Test::UploadedFile.new(File.open('spec/fixtures/sample.txt')) }
|
|
9
|
+
end
|
|
6
10
|
end
|
|
7
11
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: solidus_product_attachments
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Renuo AG
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2024-07-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: deface
|
|
@@ -193,19 +193,19 @@ dependencies:
|
|
|
193
193
|
- !ruby/object:Gem::Version
|
|
194
194
|
version: '0'
|
|
195
195
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
196
|
+
name: pg
|
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
|
198
198
|
requirements:
|
|
199
|
-
- -
|
|
199
|
+
- - ">="
|
|
200
200
|
- !ruby/object:Gem::Version
|
|
201
|
-
version:
|
|
201
|
+
version: '0'
|
|
202
202
|
type: :development
|
|
203
203
|
prerelease: false
|
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
205
|
requirements:
|
|
206
|
-
- -
|
|
206
|
+
- - ">="
|
|
207
207
|
- !ruby/object:Gem::Version
|
|
208
|
-
version:
|
|
208
|
+
version: '0'
|
|
209
209
|
description: A gem to attach files to a product / variant
|
|
210
210
|
email: info@renuo.ch
|
|
211
211
|
executables: []
|
|
@@ -271,7 +271,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
271
271
|
- !ruby/object:Gem::Version
|
|
272
272
|
version: '0'
|
|
273
273
|
requirements: []
|
|
274
|
-
rubygems_version: 3.2.
|
|
274
|
+
rubygems_version: 3.2.22
|
|
275
275
|
signing_key:
|
|
276
276
|
specification_version: 4
|
|
277
277
|
summary: A gem to attach files to a product
|