administrate-field-carrierwave 0.4.0 → 0.4.1
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 +1 -3
- data/administrate-field-carrierwave.gemspec +1 -1
- data/app/views/fields/carrierwave/_index.html.erb +1 -5
- data/app/views/fields/carrierwave/_show.html.erb +7 -1
- data/lib/administrate/field/carrierwave.rb +1 -5
- data/spec/lib/administrate/field/carrierwave_spec.rb +2 -19
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef2f6523eac7e56aaed689c5ce635e362861b2190c574eae04b7007fabd990fb
|
4
|
+
data.tar.gz: 953cca09fe43b84c4c9a18b8376b9de262fc340df32bbcb988d234135dd32228
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bf1c3759d2ae920c3ad5d6dc4405835879c50ce42ccd315e2ca8a86e84132fefb1929241e3779769cc7e190fedc9ba300c05641c787c503699081bfd55c02c8
|
7
|
+
data.tar.gz: a3afd875fbad56c571babab7a5cc4d61504d5cdc46651172f749546c9245c7581ffe19390a6a261db2ba110a5c7e47a75911fa3fbed57984fd231dc5751e31b8
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.6.
|
1
|
+
2.6.2
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.4.1](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.4.1) (2019-04-13)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.4.0...v0.4.1)
|
6
|
+
|
7
|
+
* Fix display error when no file uploaded yet
|
8
|
+
|
3
9
|
## [v0.4.0](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.4.0) (2019-03-04)
|
4
10
|
|
5
11
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.3.4...v0.4.0)
|
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.4.
|
13
|
+
gem 'administrate-field-carrierwave', '~> 0.4.1'
|
14
14
|
```
|
15
15
|
|
16
16
|
Run:
|
@@ -26,7 +26,6 @@ ATTRIBUTE_TYPES = {
|
|
26
26
|
bar: Field::Carrierwave.with_options(
|
27
27
|
image: :standard,
|
28
28
|
multiple: true,
|
29
|
-
image_on_index: true,
|
30
29
|
remove: false,
|
31
30
|
remote_url: false
|
32
31
|
)
|
@@ -45,7 +44,6 @@ end
|
|
45
44
|
### Options
|
46
45
|
|
47
46
|
* `image` (default: `nil`): a [version] that will be displayed in an `<img>` element.
|
48
|
-
* `image_on_index` (default: `false`): whether or not to show the image itself on the index list view. The default behavior (when false) is to display a "View" link that opens the image in a new tab/window when clicked.
|
49
47
|
* `multiple` (default: `false`): allows uploading of multiple files. **ATTENTION 🚨**: [requires CarrierWave’s `master` branch](https://github.com/carrierwaveuploader/carrierwave#multiple-file-uploads). Uploaded files will replace the current ones – if present – and not add to them.
|
50
48
|
* `remove` (default: `false`): allow to remove previously uploaded files. **ATTENTION 🚨** extend [`permitted_attributes`](https://github.com/thoughtbot/administrate/issues/990#issuecomment-339066788) by `remove_FIELD`
|
51
49
|
* `remote_url` (default: `false`): allow uploading files from a remote location. **ATTENTION 🚨** extend [`permitted_attributes`](https://github.com/thoughtbot/administrate/issues/990#issuecomment-339066788) by `remote_FIELD_url`
|
@@ -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.4.
|
7
|
+
gem.version = '0.4.1'
|
8
8
|
gem.authors = ['Zooppa']
|
9
9
|
gem.email = ['dev@zooppa.com']
|
10
10
|
gem.homepage = 'https://github.com/zooppa/administrate-field-carrierwave'
|
@@ -14,11 +14,7 @@ opens in a new window/tab, or the total number of attached files
|
|
14
14
|
<% if field.multiple? %>
|
15
15
|
<%= pluralize(field.files.size, field.attribute.to_s.humanize.downcase) %>
|
16
16
|
<% elsif field.file.present? %>
|
17
|
-
|
18
|
-
<%= render 'fields/carrierwave/preview', file: field.file, field: field %>
|
19
|
-
<% else %>
|
20
|
-
<%= link_to 'View', field.file.url, title: field.file.filename, target: '_blank' %>
|
21
|
-
<% end %>
|
17
|
+
<%= link_to 'View', field.file.url, title: field.file.filename, target: '_blank' %>
|
22
18
|
<% else %>
|
23
19
|
-
|
24
20
|
<% end %>
|
@@ -15,7 +15,13 @@ for this attribute
|
|
15
15
|
<% if field.files.any? %>
|
16
16
|
<ul>
|
17
17
|
<%- field.files.each do |file| %>
|
18
|
-
<li
|
18
|
+
<li>
|
19
|
+
<% if field.show_file? %>
|
20
|
+
<%= render 'fields/carrierwave/file', file: file %>
|
21
|
+
<% else %>
|
22
|
+
-
|
23
|
+
<% end %>
|
24
|
+
</li>
|
19
25
|
<% end %>
|
20
26
|
</ul>
|
21
27
|
<% else %>
|
@@ -12,10 +12,6 @@ module Administrate
|
|
12
12
|
options.fetch(:image, nil)
|
13
13
|
end
|
14
14
|
|
15
|
-
def image_on_index?
|
16
|
-
options.fetch(:image_on_index, false)
|
17
|
-
end
|
18
|
-
|
19
15
|
def multiple?
|
20
16
|
options.fetch(:multiple, false)
|
21
17
|
end
|
@@ -41,7 +37,7 @@ module Administrate
|
|
41
37
|
end
|
42
38
|
|
43
39
|
def show_file?
|
44
|
-
file.present?
|
40
|
+
file.present? && (file.filename || file.path)
|
45
41
|
end
|
46
42
|
end
|
47
43
|
end
|
@@ -8,7 +8,8 @@ describe Administrate::Field::Carrierwave do
|
|
8
8
|
let(:file) { double 'File' }
|
9
9
|
|
10
10
|
let(:cw_file) do
|
11
|
-
double 'CW with file', model: model, file: file, version_exists?: true
|
11
|
+
double 'CW with file', model: model, file: file, version_exists?: true,
|
12
|
+
filename: 'file.txt', path: '/path/to/file'
|
12
13
|
end
|
13
14
|
let(:cw_no_file) do
|
14
15
|
double 'CW without file', model: model, file: nil, version_exists?: true
|
@@ -52,24 +53,6 @@ describe Administrate::Field::Carrierwave do
|
|
52
53
|
end
|
53
54
|
end
|
54
55
|
|
55
|
-
describe '#image_on_index?' do
|
56
|
-
let(:output) { subject.image_on_index? }
|
57
|
-
|
58
|
-
context 'with nil' do
|
59
|
-
it 'returns false' do
|
60
|
-
expect(output).to be false
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'with a valid option' do
|
65
|
-
let(:options) { { image_on_index: true } }
|
66
|
-
|
67
|
-
it 'returns the value' do
|
68
|
-
expect(output).to be true
|
69
|
-
end
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
56
|
describe '#multiple?' do
|
74
57
|
let(:output) { subject.multiple? }
|
75
58
|
|
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.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Zooppa
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
- !ruby/object:Gem::Version
|
177
177
|
version: '0'
|
178
178
|
requirements: []
|
179
|
-
rubygems_version: 3.0.
|
179
|
+
rubygems_version: 3.0.3
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: Carrierwave field plugin for Administrate
|