administrate-field-carrierwave 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2ed47bc2c8af5f3df5efbc867a50240768679772
4
+ data.tar.gz: 0375530441b580036842e0b44fcb16755f10155d
5
+ SHA512:
6
+ metadata.gz: d29a2ee2cb15fbd71ae9276068e2d83179e20ecb94f6b2456276af99ffb92468d26d44420cbf3f1e6dec2ddbbe976a117bb291f435f7287bf9af98e6b24efd3b
7
+ data.tar.gz: c0926ad9e23bb5075c39e376705c986dbea9d379ec6915d1535d40062ac9710c5c567de454182be7306a94aaaf3fa3528905d5b3a6ef9c41b65e6a30138de65d
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ *.gem
data/CHANGELOG.md ADDED
@@ -0,0 +1,4 @@
1
+ # Changelog
2
+
3
+ ## [v0.0.1](https://github.com/z-productions/administrate-field-carrierwave/tree/v0.0.1) (2016-11-28)
4
+ First release
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,159 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ administrate-field-carrierwave (0.0.1)
5
+ administrate (~> 0.3.0)
6
+ rails (>= 4.2)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ actioncable (5.0.0.1)
12
+ actionpack (= 5.0.0.1)
13
+ nio4r (~> 1.2)
14
+ websocket-driver (~> 0.6.1)
15
+ actionmailer (5.0.0.1)
16
+ actionpack (= 5.0.0.1)
17
+ actionview (= 5.0.0.1)
18
+ activejob (= 5.0.0.1)
19
+ mail (~> 2.5, >= 2.5.4)
20
+ rails-dom-testing (~> 2.0)
21
+ actionpack (5.0.0.1)
22
+ actionview (= 5.0.0.1)
23
+ activesupport (= 5.0.0.1)
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.0.1)
29
+ activesupport (= 5.0.0.1)
30
+ builder (~> 3.1)
31
+ erubis (~> 2.7.0)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
+ activejob (5.0.0.1)
35
+ activesupport (= 5.0.0.1)
36
+ globalid (>= 0.3.6)
37
+ activemodel (5.0.0.1)
38
+ activesupport (= 5.0.0.1)
39
+ activerecord (5.0.0.1)
40
+ activemodel (= 5.0.0.1)
41
+ activesupport (= 5.0.0.1)
42
+ arel (~> 7.0)
43
+ activesupport (5.0.0.1)
44
+ concurrent-ruby (~> 1.0, >= 1.0.2)
45
+ i18n (~> 0.7)
46
+ minitest (~> 5.1)
47
+ tzinfo (~> 1.1)
48
+ administrate (0.3.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.5.3)
62
+ execjs
63
+ bourbon (4.2.7)
64
+ sass (~> 3.4)
65
+ thor (~> 0.19)
66
+ builder (3.2.2)
67
+ concurrent-ruby (1.0.2)
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.7.0)
75
+ jquery-rails (4.2.1)
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.9.1)
92
+ momentjs-rails (2.15.1)
93
+ railties (>= 3.1)
94
+ neat (1.8.0)
95
+ sass (>= 3.3)
96
+ thor (~> 0.19)
97
+ nio4r (1.2.1)
98
+ nokogiri (1.6.8.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.0.1)
105
+ actioncable (= 5.0.0.1)
106
+ actionmailer (= 5.0.0.1)
107
+ actionpack (= 5.0.0.1)
108
+ actionview (= 5.0.0.1)
109
+ activejob (= 5.0.0.1)
110
+ activemodel (= 5.0.0.1)
111
+ activerecord (= 5.0.0.1)
112
+ activesupport (= 5.0.0.1)
113
+ bundler (>= 1.3.0, < 2.0)
114
+ railties (= 5.0.0.1)
115
+ sprockets-rails (>= 2.0.0)
116
+ rails-dom-testing (2.0.1)
117
+ activesupport (>= 4.2.0, < 6.0)
118
+ nokogiri (~> 1.6.0)
119
+ rails-html-sanitizer (1.0.3)
120
+ loofah (~> 2.0)
121
+ railties (5.0.0.1)
122
+ actionpack (= 5.0.0.1)
123
+ activesupport (= 5.0.0.1)
124
+ method_source
125
+ rake (>= 0.8.7)
126
+ thor (>= 0.18.1, < 2.0)
127
+ rake (11.3.0)
128
+ sass (3.4.22)
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.0)
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.5)
145
+ tilt (2.0.5)
146
+ tzinfo (1.2.2)
147
+ thread_safe (~> 0.1)
148
+ websocket-driver (0.6.4)
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.13.6
data/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-2016 z.productions.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # Administrate::Field::Carrierwave
2
+
3
+ [![Code Climate](https://codeclimate.com/github/z-productions/administrate-field-carrierwave/badges/gpa.svg)](https://codeclimate.com/github/z-productions/administrate-field-carrierwave)
4
+
5
+ A plugin to upload and preview Carrierwave attachments in [Administrate].
6
+
7
+ ## Usage
8
+
9
+ Add it to your `Gemfile`:
10
+
11
+ ```ruby
12
+ gem 'administrate-field-carrierwave', '~> 0.0.1'
13
+ ```
14
+
15
+ Run:
16
+
17
+ ```bash
18
+ $ bundle install
19
+ ```
20
+
21
+ Add to your `FooDashboard`:
22
+
23
+ ```ruby
24
+ ATTRIBUTE_TYPES = {
25
+ bar: Field::Carrierwave.with_options(image: :standard)
26
+ }.freeze
27
+ ```
28
+ ### Options
29
+
30
+ * `image` (default: `nil`): a [version] that will be displayed in an `<img>` element.
31
+
32
+ ## About
33
+
34
+ `Administrate::Field::Carrierwave` is maintained by [z.productions].
35
+
36
+ [Administrate]: https://github.com/thoughtbot/administrate
37
+ [version]: https://github.com/carrierwaveuploader/carrierwave#adding-versions
38
+ [z.productions]: https://www.z.productions/
@@ -0,0 +1,19 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'administrate-field-carrierwave'
5
+ gem.version = '0.0.1'
6
+ gem.authors = ['Michele Gerarduzzi']
7
+ gem.email = ['michele.gerarduzzi@gmail.com']
8
+ gem.homepage = 'https://github.com/z-productions/administrate-field-carrierwave'
9
+ gem.summary = 'A plugin to upload Carrierwave attachments in Administrate'
10
+ gem.description = gem.summary
11
+ gem.license = 'MIT'
12
+
13
+ gem.require_paths = ['lib']
14
+ gem.files = `git ls-files`.split("\n")
15
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+
17
+ gem.add_runtime_dependency 'administrate', '~> 0.3.0'
18
+ gem.add_runtime_dependency 'rails', '>= 4.2'
19
+ end
@@ -0,0 +1,27 @@
1
+ <%#
2
+ # Carrierwave Form Partial
3
+
4
+ This partial renders a file input field.
5
+
6
+ ## Local variables:
7
+
8
+ - `f`:
9
+ A Rails form generator, used to help create the appropriate input fields.
10
+ - `field`:
11
+ An instance of Administrate::Field::Carrierwave.
12
+ A wrapper around the attribute pulled from the database.
13
+ %>
14
+
15
+ <div class="field-unit__label">
16
+ <%= f.label field.attribute %>
17
+ </div>
18
+ <div class="field-unit__field">
19
+ <%= f.file_field field.attribute %>
20
+ <br />
21
+ <%- if field.uploaded? -%>
22
+ <%= render 'fields/carrierwave/preview', field: field %>
23
+ <%= link_to field.filename, field.url, title: field.filename, target: '_blank' %>
24
+ <%- else -%>
25
+ <span>No file uploaded yet</span>
26
+ <%- end -%>
27
+ </div>
@@ -0,0 +1,14 @@
1
+ <%#
2
+ # Carrierwave Index Partial
3
+
4
+ This partial renders the URL of the attachment as a link that
5
+ opens in a new window/tab
6
+
7
+ ## Local variables:
8
+
9
+ - `field`:
10
+ An instance of Administrate::Field::Carrierwave.
11
+ A wrapper around the attribute pulled from the database.
12
+ %>
13
+
14
+ <%= link_to 'View', field.url, title: field.filename, target: '_blank' %>
@@ -0,0 +1,3 @@
1
+ <% if field.image %>
2
+ <p><%= image_tag field.url(field.image), alt: field.filename %></p>
3
+ <% end %>
@@ -0,0 +1,15 @@
1
+ <%#
2
+ # Carrierwave Show Partial
3
+
4
+ This partial renders the URL of the attachment as a link that
5
+ opens in a new window/tab, and an optional image preview
6
+
7
+ ## Local variables:
8
+
9
+ - `field`:
10
+ An instance of Administrate::Field::Carrierwave.
11
+ A wrapper around the attribute pulled from the database.
12
+ %>
13
+
14
+ <%= render 'fields/carrierwave/preview', field: field %>
15
+ <%= link_to field.filename, field.url, target: '_blank' %>
@@ -0,0 +1,21 @@
1
+ require 'administrate/field/base'
2
+ require 'rails'
3
+
4
+ module Administrate
5
+ module Field
6
+ class Engine < ::Rails::Engine
7
+ end
8
+
9
+ class Carrierwave < Administrate::Field::Base
10
+ delegate :url, :filename, to: :data, allow_nil: true
11
+
12
+ def image
13
+ options.fetch(:image, nil)
14
+ end
15
+
16
+ def uploaded?
17
+ url.present?
18
+ end
19
+ end
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-carrierwave
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Michele Gerarduzzi
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: administrate
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.3.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.3.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '4.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '4.2'
41
+ description: A plugin to upload Carrierwave attachments in Administrate
42
+ email:
43
+ - michele.gerarduzzi@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".gitignore"
49
+ - CHANGELOG.md
50
+ - Gemfile
51
+ - Gemfile.lock
52
+ - LICENSE.md
53
+ - README.md
54
+ - administrate-field-carrierwave.gemspec
55
+ - app/views/fields/carrierwave/_form.html.erb
56
+ - app/views/fields/carrierwave/_index.html.erb
57
+ - app/views/fields/carrierwave/_preview.html.erb
58
+ - app/views/fields/carrierwave/_show.html.erb
59
+ - lib/administrate/field/carrierwave.rb
60
+ homepage: https://github.com/z-productions/administrate-field-carrierwave
61
+ licenses:
62
+ - MIT
63
+ metadata: {}
64
+ post_install_message:
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '0'
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubyforge_project:
80
+ rubygems_version: 2.5.2
81
+ signing_key:
82
+ specification_version: 4
83
+ summary: A plugin to upload Carrierwave attachments in Administrate
84
+ test_files: []