administrate-field-image 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c70c83719af337aeb54e6150634cd0d3d9c73ab1
4
+ data.tar.gz: f700924489bcd55e2acf488cfc95e702dc4a2150
5
+ SHA512:
6
+ metadata.gz: d6c18138d2edb9398e46f59ad86b5e8804985662d7b03640b68177586787d0d36d69bc4f22fd51d69f5848a9325a3872164f5640a1232e60779e64d8434aa54d
7
+ data.tar.gz: 270af0e330fae14dd3ba13c3eb2aa6eff5a94e30b77ee0bb47e13a94f15238e1fe64e8d2d2b05698b4f7396392436c1c91d72d8542221be324afb923bf40865b
@@ -0,0 +1,9 @@
1
+ # Administrate::Field::Image
2
+
3
+ A plugin to show image URLs in [Administrate].
4
+
5
+ This repository is the first field plugin extracted out of Administrate.
6
+ Although its structure may change,
7
+ it's designed to act as a template for other Administrate field plugins.
8
+
9
+ [Administrate]: https://github.com/thoughtbot/administrate
@@ -0,0 +1,21 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+
3
+ require "administrate/field/image"
4
+
5
+ Gem::Specification.new do |gem|
6
+ gem.name = "administrate-field-image"
7
+ gem.version = Administrate::Field::Image::VERSION
8
+ gem.authors = ["Grayson Wright"]
9
+ gem.email = ["wright.grayson@gmail.com"]
10
+ gem.homepage = "https://github.com/graysonwright/administrate_field_image"
11
+ gem.summary = "Official Image field plugin for Administrate"
12
+ gem.description = gem.summary
13
+ gem.license = "MIT"
14
+
15
+ gem.require_paths = ["lib"]
16
+ gem.files = `git ls-files`.split("\n")
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+
19
+ gem.add_dependency "administrate", "~> 0.2.0", "0.2.0.rc1"
20
+ gem.add_dependency "rails", "~> 4.2"
21
+ end
@@ -0,0 +1,23 @@
1
+ <%#
2
+ # Image Form Partial
3
+
4
+ This partial renders an input element for image attributes.
5
+ By default, the input is a text field for the image's URL.
6
+
7
+ ## Local variables:
8
+
9
+ - `f`:
10
+ A Rails form generator, used to help create the appropriate input fields.
11
+ - `field`:
12
+ An instance of [Administrate::Field::Image][1].
13
+ A wrapper around the image url pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
16
+ %>
17
+
18
+ <div class="field-unit__label">
19
+ <%= f.label field.attribute %>
20
+ </div>
21
+ <div class="field-unit__field">
22
+ <%= f.text_field field.attribute %>
23
+ </div>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ # Image Index Partial
3
+
4
+ This partial renders an image attribute
5
+ to be displayed on a resource's index page.
6
+
7
+ By default, the attribute is rendered as an image tag.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Image][1].
13
+ A wrapper around the image url pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
16
+ %>
17
+
18
+ <%= image_tag field.data %>
@@ -0,0 +1,18 @@
1
+ <%#
2
+ # Image Show Partial
3
+
4
+ This partial renders an image attribute,
5
+ to be displayed on a resource's show page.
6
+
7
+ By default, the attribute is rendered as an image tag.
8
+
9
+ ## Local variables:
10
+
11
+ - `field`:
12
+ An instance of [Administrate::Field::Image][1].
13
+ A wrapper around the image url pulled from the database.
14
+
15
+ [1]: http://www.rubydoc.info/gems/administrate/Administrate/Field/Image
16
+ %>
17
+
18
+ <%= image_tag field.data %>
@@ -0,0 +1,13 @@
1
+ require "administrate/field/base"
2
+ require "rails"
3
+
4
+ module Administrate
5
+ module Field
6
+ class Image < Administrate::Field::Base
7
+ VERSION = "0.0.1"
8
+
9
+ class Engine < ::Rails::Engine
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ require "administrate/field/image"
2
+
3
+ describe Administrate::Field::Image do
4
+ describe "#to_partial_path" do
5
+ it "returns a partial based on the page being rendered" do
6
+ page = :show
7
+ field = Administrate::Field::Image.new(:image, "/a.jpg", page)
8
+
9
+ path = field.to_partial_path
10
+
11
+ expect(path).to eq("/fields/image/#{page}")
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,86 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-image
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Grayson Wright
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-04-21 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.2.0
20
+ - - '='
21
+ - !ruby/object:Gem::Version
22
+ version: 0.2.0.rc1
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 0.2.0
30
+ - - '='
31
+ - !ruby/object:Gem::Version
32
+ version: 0.2.0.rc1
33
+ - !ruby/object:Gem::Dependency
34
+ name: rails
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '4.2'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '4.2'
47
+ description: Official Image field plugin for Administrate
48
+ email:
49
+ - wright.grayson@gmail.com
50
+ executables: []
51
+ extensions: []
52
+ extra_rdoc_files: []
53
+ files:
54
+ - README.md
55
+ - administrate-field-image.gemspec
56
+ - app/views/fields/image/_form.html.erb
57
+ - app/views/fields/image/_index.html.erb
58
+ - app/views/fields/image/_show.html.erb
59
+ - lib/administrate/field/image.rb
60
+ - spec/lib/administrate/field/image_spec.rb
61
+ homepage: https://github.com/graysonwright/administrate_field_image
62
+ licenses:
63
+ - MIT
64
+ metadata: {}
65
+ post_install_message:
66
+ rdoc_options: []
67
+ require_paths:
68
+ - lib
69
+ required_ruby_version: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - ">="
72
+ - !ruby/object:Gem::Version
73
+ version: '0'
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
79
+ requirements: []
80
+ rubyforge_project:
81
+ rubygems_version: 2.5.1
82
+ signing_key:
83
+ specification_version: 4
84
+ summary: Official Image field plugin for Administrate
85
+ test_files:
86
+ - spec/lib/administrate/field/image_spec.rb