administrate-field-carrierwave 0.2.0 → 0.3.0
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 +5 -5
- data/.gitignore +1 -0
- data/CHANGELOG.md +17 -1
- data/LICENSE.md +1 -1
- data/README.md +7 -3
- data/administrate-field-carrierwave.gemspec +4 -4
- data/app/views/fields/carrierwave/_form.html.erb +5 -0
- data/app/views/fields/carrierwave/_index.html.erb +1 -1
- data/app/views/fields/carrierwave/_show.html.erb +1 -1
- data/lib/administrate/field/carrierwave.rb +9 -1
- metadata +11 -6
- data/Gemfile.lock +0 -159
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: '0785bcefc7b18191135609c7c948db105ed2196fd32b5c174ee4aa22c5ddf474'
|
4
|
+
data.tar.gz: 73d8f9701de8c05b1eedadf77bebd7fca865763a15591e1220216dc0f440ae72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe1612084d140a5d5cd047a8279360d08afbb60bd2381b620b16beb24ef87cb9f4e2774640055769aefc627f05cc759adb508162602ff4385e34ee0138e70501
|
7
|
+
data.tar.gz: 1eab103c7a587e173bed291ce4c7accc0b0849198d35aaeecd80082a213b917eb659c1b7ae305d3bfa8b069e5749083fe6e2071caa2cd65798163a0cb7bddab3
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,39 +1,55 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [v0.3.0](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.2.0) (2018-01-29)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.2.0...v0.3.0)
|
6
|
+
|
7
|
+
* Add ability to upload attachment from remote URL (thanks @neumayr)
|
8
|
+
* Add ability to remove attachments (thanks @neumayr)
|
9
|
+
* Do not display preview unless ready (thanks @mnrk)
|
10
|
+
|
3
11
|
## [v0.2.0](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.2.0) (2017-06-06)
|
12
|
+
|
4
13
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.1.3...v0.2.0)
|
5
14
|
|
6
|
-
* Add ability to show image on index
|
15
|
+
* Add ability to show image on index (thanks @jondkinney)
|
7
16
|
|
8
17
|
## [v0.1.3](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.1.3) (2017-04-03)
|
18
|
+
|
9
19
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.1.2...v0.1.3)
|
10
20
|
|
11
21
|
* Bump up Administrate dependency
|
12
22
|
|
13
23
|
## [v0.1.2](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.1.2) (2017-03-21)
|
24
|
+
|
14
25
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.1.1...v0.1.2)
|
15
26
|
|
16
27
|
* Fix case of missing file
|
17
28
|
|
18
29
|
## [v0.1.1](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.1.1) (2017-03-20)
|
30
|
+
|
19
31
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.1.0...v0.1.1)
|
20
32
|
|
21
33
|
* Bump up Administrate dependency
|
22
34
|
|
23
35
|
## [v0.1.0](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.1.0) (2016-11-30)
|
36
|
+
|
24
37
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.0.3...v0.1.0)
|
25
38
|
|
26
39
|
* Add support for multiple files
|
27
40
|
|
28
41
|
## [v0.0.3](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.0.3) (2016-11-29)
|
42
|
+
|
29
43
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.0.2...v0.0.3)
|
30
44
|
|
31
45
|
* Improve attachment name visualization
|
32
46
|
|
33
47
|
## [v0.0.2](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.0.2) (2016-11-29)
|
48
|
+
|
34
49
|
[Full Changelog](https://github.com/zooppa/administrate-field-carrierwave/compare/v0.0.1...v0.0.2)
|
35
50
|
|
36
51
|
* Fix engine class declaration
|
37
52
|
|
38
53
|
## [v0.0.1](https://github.com/zooppa/administrate-field-carrierwave/tree/v0.0.1) (2016-11-28)
|
54
|
+
|
39
55
|
First release
|
data/LICENSE.md
CHANGED
data/README.md
CHANGED
@@ -9,7 +9,7 @@ A plugin to upload and preview Carrierwave attachments in [Administrate].
|
|
9
9
|
Add it to your `Gemfile`:
|
10
10
|
|
11
11
|
```ruby
|
12
|
-
gem 'administrate-field-carrierwave', '~> 0.
|
12
|
+
gem 'administrate-field-carrierwave', '~> 0.3.0'
|
13
13
|
```
|
14
14
|
|
15
15
|
Run:
|
@@ -25,7 +25,9 @@ ATTRIBUTE_TYPES = {
|
|
25
25
|
bar: Field::Carrierwave.with_options(
|
26
26
|
image: :standard,
|
27
27
|
multiple: true,
|
28
|
-
image_on_index: true
|
28
|
+
image_on_index: true,
|
29
|
+
remove: false,
|
30
|
+
remote_url: false
|
29
31
|
)
|
30
32
|
}.freeze
|
31
33
|
```
|
@@ -44,6 +46,8 @@ end
|
|
44
46
|
* `image` (default: `nil`): a [version] that will be displayed in an `<img>` element.
|
45
47
|
* `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.
|
46
48
|
* `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.
|
49
|
+
* `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`
|
50
|
+
* `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`
|
47
51
|
|
48
52
|
## About
|
49
53
|
|
@@ -51,6 +55,6 @@ end
|
|
51
55
|
|
52
56
|
See also the list of [contributors](https://github.com/zooppa/administrate-field-carrierwave/contributors) who participated in this project.
|
53
57
|
|
54
|
-
[
|
58
|
+
[administrate]: https://github.com/thoughtbot/administrate
|
55
59
|
[version]: https://github.com/carrierwaveuploader/carrierwave#adding-versions
|
56
60
|
[z.productions]: https://www.z.productions/
|
@@ -2,12 +2,12 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
4
|
gem.name = 'administrate-field-carrierwave'
|
5
|
-
gem.version = '0.
|
5
|
+
gem.version = '0.3.0'
|
6
6
|
gem.authors = ['Michele Gerarduzzi']
|
7
7
|
gem.email = ['michele.gerarduzzi@gmail.com']
|
8
8
|
gem.homepage = 'https://github.com/zooppa/administrate-field-carrierwave'
|
9
|
-
gem.summary = '
|
10
|
-
gem.description =
|
9
|
+
gem.summary = 'Carrierwave field plugin for Administrate'
|
10
|
+
gem.description = 'A plugin to manage Carrierwave attachments in Administrate'
|
11
11
|
gem.license = 'MIT'
|
12
12
|
|
13
13
|
gem.require_paths = ['lib']
|
@@ -15,5 +15,5 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
16
|
|
17
17
|
gem.add_runtime_dependency 'administrate', '< 1.0.0'
|
18
|
-
gem.add_runtime_dependency 'rails', '>= 4.2'
|
18
|
+
gem.add_runtime_dependency 'rails', '>= 4.2', '< 6'
|
19
19
|
end
|
@@ -18,6 +18,11 @@ attachment(s) for this attribute
|
|
18
18
|
</div>
|
19
19
|
<div class="field-unit__field">
|
20
20
|
<%= f.file_field field.attribute, multiple: field.multiple? %>
|
21
|
+
<%= f.text_field "remote_#{field.attribute}_url", placeholder: "Remote URL" if field.remote_url? %>
|
21
22
|
<br />
|
22
23
|
<%= render 'fields/carrierwave/show', field: field %>
|
24
|
+
|
25
|
+
<%= f.label "remove_#{field.attribute}" do %>
|
26
|
+
<%= f.check_box "remove_#{field.attribute}" %> Remove <%= field.attribute %>
|
27
|
+
<% end if field.remove? %>
|
23
28
|
</div>
|
@@ -14,7 +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 %>
|
17
|
+
<% if field.image_on_index? %>
|
18
18
|
<%= render 'fields/carrierwave/preview', file: field.file, field: field %>
|
19
19
|
<% else %>
|
20
20
|
<%= link_to 'View', field.file.url, title: field.file.filename, target: '_blank' %>
|
@@ -22,7 +22,7 @@ for this attribute
|
|
22
22
|
<span>No file(s) uploaded yet</span>
|
23
23
|
<% end %>
|
24
24
|
<% else %>
|
25
|
-
<% if field.image.present? && field.data.model.persisted? %>
|
25
|
+
<% if field.image.present? && field.data.model.persisted? && field.file.version_exists?(field.image) %>
|
26
26
|
<%= render 'fields/carrierwave/preview', file: field.file, field: field %>
|
27
27
|
<% elsif field.file.present? %>
|
28
28
|
<%= render 'fields/carrierwave/file', file: field.file %>
|
@@ -10,7 +10,7 @@ module Administrate
|
|
10
10
|
options.fetch(:image, nil)
|
11
11
|
end
|
12
12
|
|
13
|
-
def image_on_index
|
13
|
+
def image_on_index?
|
14
14
|
options.fetch(:image_on_index, false)
|
15
15
|
end
|
16
16
|
|
@@ -18,6 +18,14 @@ module Administrate
|
|
18
18
|
options.fetch(:multiple, false)
|
19
19
|
end
|
20
20
|
|
21
|
+
def remove?
|
22
|
+
options.fetch(:remove, false)
|
23
|
+
end
|
24
|
+
|
25
|
+
def remote_url?
|
26
|
+
options.fetch(:remote_url, false)
|
27
|
+
end
|
28
|
+
|
21
29
|
# One-element array when single file field, array of files when multiple
|
22
30
|
def files
|
23
31
|
Array[*data]
|
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
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michele Gerarduzzi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: administrate
|
@@ -31,6 +31,9 @@ dependencies:
|
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '4.2'
|
34
|
+
- - "<"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '6'
|
34
37
|
type: :runtime
|
35
38
|
prerelease: false
|
36
39
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -38,7 +41,10 @@ dependencies:
|
|
38
41
|
- - ">="
|
39
42
|
- !ruby/object:Gem::Version
|
40
43
|
version: '4.2'
|
41
|
-
|
44
|
+
- - "<"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '6'
|
47
|
+
description: A plugin to manage Carrierwave attachments in Administrate
|
42
48
|
email:
|
43
49
|
- michele.gerarduzzi@gmail.com
|
44
50
|
executables: []
|
@@ -48,7 +54,6 @@ files:
|
|
48
54
|
- ".gitignore"
|
49
55
|
- CHANGELOG.md
|
50
56
|
- Gemfile
|
51
|
-
- Gemfile.lock
|
52
57
|
- LICENSE.md
|
53
58
|
- README.md
|
54
59
|
- administrate-field-carrierwave.gemspec
|
@@ -78,8 +83,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
83
|
version: '0'
|
79
84
|
requirements: []
|
80
85
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
86
|
+
rubygems_version: 2.7.3
|
82
87
|
signing_key:
|
83
88
|
specification_version: 4
|
84
|
-
summary:
|
89
|
+
summary: Carrierwave field plugin for Administrate
|
85
90
|
test_files: []
|
data/Gemfile.lock
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
administrate-field-carrierwave (0.1.3)
|
5
|
-
administrate (< 1.0.0)
|
6
|
-
rails (>= 4.2)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
actioncable (5.0.2)
|
12
|
-
actionpack (= 5.0.2)
|
13
|
-
nio4r (>= 1.2, < 3.0)
|
14
|
-
websocket-driver (~> 0.6.1)
|
15
|
-
actionmailer (5.0.2)
|
16
|
-
actionpack (= 5.0.2)
|
17
|
-
actionview (= 5.0.2)
|
18
|
-
activejob (= 5.0.2)
|
19
|
-
mail (~> 2.5, >= 2.5.4)
|
20
|
-
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.0.2)
|
22
|
-
actionview (= 5.0.2)
|
23
|
-
activesupport (= 5.0.2)
|
24
|
-
rack (~> 2.0)
|
25
|
-
rack-test (~> 0.6.3)
|
26
|
-
rails-dom-testing (~> 2.0)
|
27
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.0.2)
|
29
|
-
activesupport (= 5.0.2)
|
30
|
-
builder (~> 3.1)
|
31
|
-
erubis (~> 2.7.0)
|
32
|
-
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.0.2)
|
35
|
-
activesupport (= 5.0.2)
|
36
|
-
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.0.2)
|
38
|
-
activesupport (= 5.0.2)
|
39
|
-
activerecord (5.0.2)
|
40
|
-
activemodel (= 5.0.2)
|
41
|
-
activesupport (= 5.0.2)
|
42
|
-
arel (~> 7.0)
|
43
|
-
activesupport (5.0.2)
|
44
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
45
|
-
i18n (~> 0.7)
|
46
|
-
minitest (~> 5.1)
|
47
|
-
tzinfo (~> 1.1)
|
48
|
-
administrate (0.4.0)
|
49
|
-
autoprefixer-rails (~> 6.0)
|
50
|
-
bourbon (~> 4.2)
|
51
|
-
datetime_picker_rails (~> 0.0.7)
|
52
|
-
jquery-rails (~> 4.0)
|
53
|
-
kaminari (~> 0.16)
|
54
|
-
momentjs-rails (~> 2.8)
|
55
|
-
neat (~> 1.1)
|
56
|
-
normalize-rails (~> 3.0)
|
57
|
-
rails (>= 4.2, < 5.1)
|
58
|
-
sass-rails (~> 5.0)
|
59
|
-
selectize-rails (~> 0.6)
|
60
|
-
arel (7.1.4)
|
61
|
-
autoprefixer-rails (6.7.7)
|
62
|
-
execjs
|
63
|
-
bourbon (4.3.3)
|
64
|
-
sass (~> 3.4)
|
65
|
-
thor (~> 0.19)
|
66
|
-
builder (3.2.3)
|
67
|
-
concurrent-ruby (1.0.5)
|
68
|
-
datetime_picker_rails (0.0.7)
|
69
|
-
momentjs-rails (>= 2.8.1)
|
70
|
-
erubis (2.7.0)
|
71
|
-
execjs (2.7.0)
|
72
|
-
globalid (0.3.7)
|
73
|
-
activesupport (>= 4.1.0)
|
74
|
-
i18n (0.8.1)
|
75
|
-
jquery-rails (4.2.2)
|
76
|
-
rails-dom-testing (>= 1, < 3)
|
77
|
-
railties (>= 4.2.0)
|
78
|
-
thor (>= 0.14, < 2.0)
|
79
|
-
kaminari (0.17.0)
|
80
|
-
actionpack (>= 3.0.0)
|
81
|
-
activesupport (>= 3.0.0)
|
82
|
-
loofah (2.0.3)
|
83
|
-
nokogiri (>= 1.5.9)
|
84
|
-
mail (2.6.4)
|
85
|
-
mime-types (>= 1.16, < 4)
|
86
|
-
method_source (0.8.2)
|
87
|
-
mime-types (3.1)
|
88
|
-
mime-types-data (~> 3.2015)
|
89
|
-
mime-types-data (3.2016.0521)
|
90
|
-
mini_portile2 (2.1.0)
|
91
|
-
minitest (5.10.1)
|
92
|
-
momentjs-rails (2.17.1)
|
93
|
-
railties (>= 3.1)
|
94
|
-
neat (1.8.0)
|
95
|
-
sass (>= 3.3)
|
96
|
-
thor (~> 0.19)
|
97
|
-
nio4r (2.0.0)
|
98
|
-
nokogiri (1.7.1)
|
99
|
-
mini_portile2 (~> 2.1.0)
|
100
|
-
normalize-rails (3.0.3)
|
101
|
-
rack (2.0.1)
|
102
|
-
rack-test (0.6.3)
|
103
|
-
rack (>= 1.0)
|
104
|
-
rails (5.0.2)
|
105
|
-
actioncable (= 5.0.2)
|
106
|
-
actionmailer (= 5.0.2)
|
107
|
-
actionpack (= 5.0.2)
|
108
|
-
actionview (= 5.0.2)
|
109
|
-
activejob (= 5.0.2)
|
110
|
-
activemodel (= 5.0.2)
|
111
|
-
activerecord (= 5.0.2)
|
112
|
-
activesupport (= 5.0.2)
|
113
|
-
bundler (>= 1.3.0, < 2.0)
|
114
|
-
railties (= 5.0.2)
|
115
|
-
sprockets-rails (>= 2.0.0)
|
116
|
-
rails-dom-testing (2.0.2)
|
117
|
-
activesupport (>= 4.2.0, < 6.0)
|
118
|
-
nokogiri (~> 1.6)
|
119
|
-
rails-html-sanitizer (1.0.3)
|
120
|
-
loofah (~> 2.0)
|
121
|
-
railties (5.0.2)
|
122
|
-
actionpack (= 5.0.2)
|
123
|
-
activesupport (= 5.0.2)
|
124
|
-
method_source
|
125
|
-
rake (>= 0.8.7)
|
126
|
-
thor (>= 0.18.1, < 2.0)
|
127
|
-
rake (12.0.0)
|
128
|
-
sass (3.4.23)
|
129
|
-
sass-rails (5.0.6)
|
130
|
-
railties (>= 4.0.0, < 6)
|
131
|
-
sass (~> 3.1)
|
132
|
-
sprockets (>= 2.8, < 4.0)
|
133
|
-
sprockets-rails (>= 2.0, < 4.0)
|
134
|
-
tilt (>= 1.1, < 3)
|
135
|
-
selectize-rails (0.12.4)
|
136
|
-
sprockets (3.7.1)
|
137
|
-
concurrent-ruby (~> 1.0)
|
138
|
-
rack (> 1, < 3)
|
139
|
-
sprockets-rails (3.2.0)
|
140
|
-
actionpack (>= 4.0)
|
141
|
-
activesupport (>= 4.0)
|
142
|
-
sprockets (>= 3.0.0)
|
143
|
-
thor (0.19.4)
|
144
|
-
thread_safe (0.3.6)
|
145
|
-
tilt (2.0.7)
|
146
|
-
tzinfo (1.2.2)
|
147
|
-
thread_safe (~> 0.1)
|
148
|
-
websocket-driver (0.6.5)
|
149
|
-
websocket-extensions (>= 0.1.0)
|
150
|
-
websocket-extensions (0.1.2)
|
151
|
-
|
152
|
-
PLATFORMS
|
153
|
-
ruby
|
154
|
-
|
155
|
-
DEPENDENCIES
|
156
|
-
administrate-field-carrierwave!
|
157
|
-
|
158
|
-
BUNDLED WITH
|
159
|
-
1.14.6
|