administrate-field-paperclip 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: 3d41e35ed69b05f97239bfc3d8761ce29c423d55
4
+ data.tar.gz: 1243a8110b8f491f69a82c3fdeb9cd9fa60d4e82
5
+ SHA512:
6
+ metadata.gz: '01836a41e2120c6a1a2873770be1abe15893cc4082b914a2a224711164c7230c51942ddf6f4d1fc9f7244a7750b2465469f24e622cec89bd0048e13706eee0d2'
7
+ data.tar.gz: b731b352618d245bcfb251be6b1e12f9f459925ce6ec8cf5c065903fdc0046b057f62ad379c87e53abd05d67c9f549405ea873a448eda74d36199f9bb4b4e557
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /*.gem
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Fernando Briano
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 all
13
+ 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 THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Administrate::Field::Paperclip
2
+
3
+ A plugin to integrate [Paperclip](https://github.com/thoughtbot/paperclip) fields in [Administrate](https://github.com/thoughtbot/administrate).
4
+
5
+ # Instructions
6
+
7
+ Add `administrate-field-paperclip` and `paperclip` to your Gemfile:
8
+
9
+ ```
10
+ gem 'administrate-field-paperclip'
11
+ gem 'paperclip'
12
+ ```
13
+
14
+ Install:
15
+
16
+ ```
17
+ $ bundle install
18
+ ```
19
+
20
+ Follow the [instructions on Paperclip](https://github.com/thoughtbot/paperclip#quick-start) to get started with your models and migrations. Once you've added the Paperclip attribute to your models, edit your Administrate dashboards. If you added 'avatar' to 'User', then you should:
21
+
22
+ * Add `avatar: Field::PaperclipField` to `ATTRIBUTE_TYPES`.
23
+ * Add `:avatar` to `FORM_ATTRIBUTES`, `SHOW_PAGE_ATTRIBUTES` and (optionally) `COLLECTION_ATTRIBUTES`.
24
+
25
+ Based on the [Administrate::Field::Image](https://github.com/thoughtbot/administrate-field-image) template.
data/Rakefile ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env rake
2
+
3
+ begin
4
+ require "bundler/setup"
5
+ rescue LoadError
6
+ puts "You must `gem install bundler` and `bundle install` to run rake tasks"
7
+ end
8
+
9
+ require "bundler/gem_tasks"
10
+
11
+ ##
12
+ # Configure the test suite.
13
+ ##
14
+ require "rspec/core"
15
+ require "rspec/core/rake_task"
16
+
17
+ RSpec::Core::RakeTask.new
18
+
19
+ ##
20
+ # By default, just run the tests.
21
+ ##
22
+ task default: :spec
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |gem|
4
+ gem.name = 'administrate-field-paperclip'
5
+ gem.version = '0.0.1'
6
+ gem.authors = ['Fernando Briano']
7
+ gem.email = ['fernando@picandocodigo.net']
8
+ gem.homepage = 'https://github.com/picandocodigo/administrate-field-paperclip'
9
+ gem.summary = 'Paperclip field plugin for Administrate'
10
+ gem.description = 'Integrates Paperclip as a field for Administrate in Rails apps'
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_dependency 'administrate', '~> 0.4'
18
+ gem.add_dependency 'rails', '~> 5.0'
19
+
20
+ gem.add_development_dependency 'rspec', '~> 3.5'
21
+ end
@@ -0,0 +1,6 @@
1
+ <div class="field-unit__label">
2
+ <%= f.label field.attribute %>
3
+ </div>
4
+ <div class="field-unit__field">
5
+ <%= f.file_field field.attribute %>
6
+ </div>
@@ -0,0 +1 @@
1
+ <%= image_tag field.thumbnail %>
@@ -0,0 +1 @@
1
+ <%= image_tag field.url if field.url.present? %>
@@ -0,0 +1,22 @@
1
+ require 'administrate/field/base'
2
+ require 'rails'
3
+
4
+ module Administrate
5
+ module Field
6
+ class PaperclipField < Administrate::Field::Base
7
+ def url
8
+ data.url
9
+ end
10
+
11
+ def thumbnail
12
+ data.url(:thumbnail)
13
+ end
14
+
15
+ def to_s
16
+ data
17
+ end
18
+ class Engine < ::Rails::Engine
19
+ end
20
+ end
21
+ end
22
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-paperclip
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Fernando Briano
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-03-07 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.4'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.4'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rails
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '5.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '5.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.5'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.5'
55
+ description: Integrates Paperclip as a field for Administrate in Rails apps
56
+ email:
57
+ - fernando@picandocodigo.net
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - administrate-field-paperclip.gemspec
68
+ - app/views/fields/paperclip_field/_form.html.erb
69
+ - app/views/fields/paperclip_field/_index.html.erb
70
+ - app/views/fields/paperclip_field/_show.html.erb
71
+ - lib/administrate/field/paperclip.rb
72
+ homepage: https://github.com/picandocodigo/administrate-field-paperclip
73
+ licenses:
74
+ - MIT
75
+ metadata: {}
76
+ post_install_message:
77
+ rdoc_options: []
78
+ require_paths:
79
+ - lib
80
+ required_ruby_version: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - ">="
83
+ - !ruby/object:Gem::Version
84
+ version: '0'
85
+ required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ requirements: []
91
+ rubyforge_project:
92
+ rubygems_version: 2.6.10
93
+ signing_key:
94
+ specification_version: 4
95
+ summary: Paperclip field plugin for Administrate
96
+ test_files: []
97
+ has_rdoc: