administrate-field-carrierwave 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c35090dece6d63d2beefce56064a76702435f65d1e6f402a5b874cca13cc038
4
- data.tar.gz: c4607f596d442f8df41b698734b59e7a356b8ff84a4cefae60bc02ef19b4f4e2
3
+ metadata.gz: ef2f6523eac7e56aaed689c5ce635e362861b2190c574eae04b7007fabd990fb
4
+ data.tar.gz: 953cca09fe43b84c4c9a18b8376b9de262fc340df32bbcb988d234135dd32228
5
5
  SHA512:
6
- metadata.gz: 190d25074a08a85535fd4e26c5fc5fe7011380a3715efc0c475db8d5544e3070c4fd1c96ec5112078dbc2365cd0cb90fd0b2e258275bb2fd924b9c4379cd5822
7
- data.tar.gz: d66ab4a9de0a128a6e2d2c500da233c9c2b614741fc09b7f304f3c906117c33e7cd7eefe63509838ef712b6698467ba8736368ab913a613064cb6548b3495ff5
6
+ metadata.gz: 9bf1c3759d2ae920c3ad5d6dc4405835879c50ce42ccd315e2ca8a86e84132fefb1929241e3779769cc7e190fedc9ba300c05641c787c503699081bfd55c02c8
7
+ data.tar.gz: a3afd875fbad56c571babab7a5cc4d61504d5cdc46651172f749546c9245c7581ffe19390a6a261db2ba110a5c7e47a75911fa3fbed57984fd231dc5751e31b8
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.6.0
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.0'
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.0'
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
- <% if field.image_on_index? %>
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><%= render 'fields/carrierwave/file', file: file %></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.0
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-03-04 00:00:00.000000000 Z
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.1
179
+ rubygems_version: 3.0.3
180
180
  signing_key:
181
181
  specification_version: 4
182
182
  summary: Carrierwave field plugin for Administrate