administrate-field-carrierwave 0.3.3 → 0.3.4
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/.ruby-version +1 -1
- data/CHANGELOG.md +6 -0
- data/README.md +2 -2
- data/administrate-field-carrierwave.gemspec +1 -1
- data/lib/administrate/field/carrierwave.rb +7 -4
- data/spec/lib/administrate/field/carrierwave_spec.rb +14 -2
- 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: 5e943fb6e75cee528c4c7535105a3b44033d062356b16f125ff7181440a83199
|
4
|
+
data.tar.gz: 4251ee8e513bd2e958833b0cec3fd7cc600a17752a6d91738ae01c43e5e0e260
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eda77052d25c80887b0ea7e964772634b5f79fc3781c15f3037ca225c262c8c6ae657e331ea1db83a9c524c06809a900109a108dde1b3bf7d6f1610fcc02fcf6
|
7
|
+
data.tar.gz: 73be66e26b6327e808a0d2e08ccd5f424542dc511b89be7369eefa1410ca4db3508acadf95ebf5f4f03f52400d5f4c40653a8ecb9fb907c34d828236fa7b3ea3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.5.
|
1
|
+
2.5.3
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.3.4](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.3.4) (2018-10-23)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.3.3...v0.3.4)
|
6
|
+
|
7
|
+
* Check for version only if option is specified (thanks @00dav00)
|
8
|
+
|
3
9
|
## [v0.3.3](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.3.3) (2018-10-11)
|
4
10
|
|
5
11
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.3.2...v0.3.3)
|
data/README.md
CHANGED
@@ -10,7 +10,7 @@ A plugin to upload and preview Carrierwave attachments in [Administrate].
|
|
10
10
|
Add it to your `Gemfile`:
|
11
11
|
|
12
12
|
```ruby
|
13
|
-
gem 'administrate-field-carrierwave', '~> 0.3.
|
13
|
+
gem 'administrate-field-carrierwave', '~> 0.3.4'
|
14
14
|
```
|
15
15
|
|
16
16
|
Run:
|
@@ -52,7 +52,7 @@ end
|
|
52
52
|
|
53
53
|
## About
|
54
54
|
|
55
|
-
`Administrate::Field::Carrierwave` is maintained by [
|
55
|
+
`Administrate::Field::Carrierwave` is maintained by [Zooppa].
|
56
56
|
|
57
57
|
See also the list of [contributors](https://github.com/zooppa/administrate-field-carrierwave/contributors) who participated in this project.
|
58
58
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.push File.expand_path('lib', __dir__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = 'administrate-field-carrierwave'
|
7
|
-
gem.version = '0.3.
|
7
|
+
gem.version = '0.3.4'
|
8
8
|
gem.authors = ['Michele Gerarduzzi']
|
9
9
|
gem.email = ['michele.gerarduzzi@gmail.com']
|
10
10
|
gem.homepage = 'https://github.com/zooppa/administrate-field-carrierwave'
|
@@ -9,7 +9,7 @@ module Administrate
|
|
9
9
|
class Engine < ::Rails::Engine; end
|
10
10
|
|
11
11
|
def image
|
12
|
-
options.fetch(:image,
|
12
|
+
options.fetch(:image, nil)
|
13
13
|
end
|
14
14
|
|
15
15
|
def image_on_index?
|
@@ -36,10 +36,13 @@ module Administrate
|
|
36
36
|
files.first
|
37
37
|
end
|
38
38
|
|
39
|
+
def model
|
40
|
+
data.try(:model)
|
41
|
+
end
|
42
|
+
|
39
43
|
def show_preview?
|
40
|
-
|
41
|
-
|
42
|
-
file.version_exists?(image)
|
44
|
+
has_file = model.try(:persisted?) && file.present?
|
45
|
+
has_file && (image ? file.version_exists?(image) : true)
|
43
46
|
end
|
44
47
|
|
45
48
|
def show_file?
|
@@ -13,6 +13,10 @@ describe Administrate::Field::Carrierwave do
|
|
13
13
|
let(:cw_no_file) do
|
14
14
|
double 'CW without file', model: model, file: nil, version_exists?: true
|
15
15
|
end
|
16
|
+
let(:cw_no_version) do
|
17
|
+
double 'CW with file, no version', model: model, file: file,
|
18
|
+
version_exists?: false
|
19
|
+
end
|
16
20
|
|
17
21
|
let(:data) { cw_file }
|
18
22
|
let(:options) { {} }
|
@@ -34,8 +38,8 @@ describe Administrate::Field::Carrierwave do
|
|
34
38
|
allow(subject).to receive(:options).and_return(options)
|
35
39
|
end
|
36
40
|
|
37
|
-
it 'returns
|
38
|
-
expect(output).to
|
41
|
+
it 'returns nil' do
|
42
|
+
expect(output).to be_nil
|
39
43
|
end
|
40
44
|
end
|
41
45
|
|
@@ -167,6 +171,14 @@ describe Administrate::Field::Carrierwave do
|
|
167
171
|
expect(output).to be_falsey
|
168
172
|
end
|
169
173
|
end
|
174
|
+
|
175
|
+
context 'when there is an unversioned image to show' do
|
176
|
+
let(:data) { cw_no_version }
|
177
|
+
|
178
|
+
it 'returns true' do
|
179
|
+
expect(output).to be_truthy
|
180
|
+
end
|
181
|
+
end
|
170
182
|
end
|
171
183
|
|
172
184
|
describe '#show_file?' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-carrierwave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michele Gerarduzzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|