solidus_product_attachments 0.0.6 → 0.0.8
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/engine.rb +5 -0
- data/lib/solidus_product_attachments/testing_support/factories/attachments.rb +4 -0
- data/lib/solidus_product_attachments/version.rb +1 -1
- metadata +8 -11
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1b7f4437281edead779f645aff8690b8daa234dcc890e277d4f69bd696e1a1bd
|
|
4
|
+
data.tar.gz: 0ef0310617063f3e75b3d5b39c3f9ffdfebb03da3aeda8d2f942c1368a135dfb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a397e96495fa07d9d275c75863b4d0ffce3988625347a64dd84e30bf43b00ba667f9028424a81f243b2243925f49eb187c910233a4e38fc0945240a6df0ca072
|
|
7
|
+
data.tar.gz: a143e46422cedefaea831552e5bb4a47b7287211e6bda209863488796ecbd11ec2908c4ee6ea5d2f8f227cf1b635cbdc1e25216b7808d197153a1884c7e2a40e
|
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?
|
|
@@ -9,6 +9,11 @@ module SolidusProductAttachments
|
|
|
9
9
|
g.test_framework :rspec
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
+
initializer 'solidus_product_attachments.autoloader' do
|
|
13
|
+
overrides_path = root.join('app/overrides')
|
|
14
|
+
Rails.autoloaders.main.ignore(overrides_path) if overrides_path.exist?
|
|
15
|
+
end
|
|
16
|
+
|
|
12
17
|
def self.activate
|
|
13
18
|
Dir.glob(File.join(File.dirname(__FILE__), '../../app/**/*_decorator*.rb')) do |c|
|
|
14
19
|
Rails.configuration.cache_classes ? require(c) : load(c)
|
|
@@ -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,13 @@
|
|
|
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.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Renuo AG
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: deface
|
|
@@ -193,19 +192,19 @@ dependencies:
|
|
|
193
192
|
- !ruby/object:Gem::Version
|
|
194
193
|
version: '0'
|
|
195
194
|
- !ruby/object:Gem::Dependency
|
|
196
|
-
name:
|
|
195
|
+
name: pg
|
|
197
196
|
requirement: !ruby/object:Gem::Requirement
|
|
198
197
|
requirements:
|
|
199
|
-
- -
|
|
198
|
+
- - ">="
|
|
200
199
|
- !ruby/object:Gem::Version
|
|
201
|
-
version:
|
|
200
|
+
version: '0'
|
|
202
201
|
type: :development
|
|
203
202
|
prerelease: false
|
|
204
203
|
version_requirements: !ruby/object:Gem::Requirement
|
|
205
204
|
requirements:
|
|
206
|
-
- -
|
|
205
|
+
- - ">="
|
|
207
206
|
- !ruby/object:Gem::Version
|
|
208
|
-
version:
|
|
207
|
+
version: '0'
|
|
209
208
|
description: A gem to attach files to a product / variant
|
|
210
209
|
email: info@renuo.ch
|
|
211
210
|
executables: []
|
|
@@ -256,7 +255,6 @@ homepage: https://www.renuo.ch
|
|
|
256
255
|
licenses:
|
|
257
256
|
- BSD-3-Clause
|
|
258
257
|
metadata: {}
|
|
259
|
-
post_install_message:
|
|
260
258
|
rdoc_options: []
|
|
261
259
|
require_paths:
|
|
262
260
|
- lib
|
|
@@ -271,8 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
271
269
|
- !ruby/object:Gem::Version
|
|
272
270
|
version: '0'
|
|
273
271
|
requirements: []
|
|
274
|
-
rubygems_version: 3.
|
|
275
|
-
signing_key:
|
|
272
|
+
rubygems_version: 3.6.9
|
|
276
273
|
specification_version: 4
|
|
277
274
|
summary: A gem to attach files to a product
|
|
278
275
|
test_files: []
|