administrate-field-enumerate 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
+ SHA256:
3
+ metadata.gz: 36ccf6c4d7b6c00928dc357ad9c1826b75629118f5ee4281fb55413d8c9e913b
4
+ data.tar.gz: b12fc392c2b58ff84d6b970d47bf78a057c2492ef7cf8e0843e5034efaef8754
5
+ SHA512:
6
+ metadata.gz: f110a2dc470909531ad7964f56483258039d4ad2c048cd510e0522197a507c182092f264ad2675b730c03e6879b6b0ffffcd5a4e12df93ca3664b6ceb6660427
7
+ data.tar.gz: 2ea7736f2192fe1b2f756cd81dac465b96b641407087efd44b483d19ff7738cad91ee1c43b342ccc3c4fa341b291fbc7f74bada99845c8e7c11a14adbb3d5f9a
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ source 'http://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development, :test do
6
+ gem 'rspec-rails', '~> 3.5.0'
7
+ gem 'pry-byebug'
8
+ end
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Source Labs LLC
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.
@@ -0,0 +1,28 @@
1
+ ## administrate-enumerate
2
+
3
+ A plugin to show [enumerate_it](https://github.com/lucascaton/enumerate_it) attributes in [Administrate](https://github.com/thoughtbot/administrate).
4
+
5
+ ## Installation
6
+
7
+ Add to Gemfile:
8
+
9
+ ```
10
+ gem 'administrate-field-enumerate'
11
+ ```
12
+
13
+ In your terminal execute:
14
+
15
+ ```
16
+ $ bundle install
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ## Contributing
22
+
23
+ Bug reports and pull requests are welcome on GitHub at https://github.com/SourceLabsLLC/administrate-field-enumerate
24
+
25
+ ## License
26
+
27
+ [MIT License](https://github.com/SourceLabsLLC/administrate-field-enumerate/blob/master/LICENSE.md)
28
+
@@ -0,0 +1,20 @@
1
+ $:.push File.expand_path('../lib', __FILE__)
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'administrate-field-enumerate'
5
+ s.version = '0.0.1'
6
+ s.authors = ['Jônatas Rancan', 'Andrei Bondarev']
7
+ s.email = ['hello@sourcelabs.io']
8
+ s.homepage = 'https://github.com/SourceLabsLLC/administrate-field-enumerate'
9
+ s.summary = s.description = 'enumerate_it field plugin for Administrate'
10
+ s.description = s.summary
11
+ s.license = 'MIT'
12
+
13
+ s.require_paths = ['lib']
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+
17
+ s.add_dependency 'administrate'
18
+ s.add_dependency 'enumerate_it'
19
+ s.add_dependency 'rails', '>= 4.2', '< 6.0'
20
+ 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.select field.attribute, field.choices %>
6
+ </div>
@@ -0,0 +1 @@
1
+ <%= field.to_s %>
@@ -0,0 +1 @@
1
+ <%= field.to_s %>
@@ -0,0 +1,19 @@
1
+ require 'administrate/field/base'
2
+ require 'rails'
3
+
4
+ module Administrate
5
+ module Field
6
+ class Enumerate < Administrate::Field::Base
7
+ def choices
8
+ attribute.to_s.camelize.constantize.to_a
9
+ end
10
+
11
+ def to_s
12
+ resource.public_send(attribute.to_s + "_humanize")
13
+ end
14
+
15
+ class Engine < ::Rails::Engine
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,14 @@
1
+ require 'administrate/field/enumerate'
2
+
3
+ describe Administrate::Field::Enumerate do
4
+ describe '#to_partial_path' do
5
+ it 'returns a partial based on the page being rendered' do
6
+ page = :show
7
+ field = described_class.new(:status, 'status', page)
8
+
9
+ path = field.to_partial_path
10
+
11
+ expect(path).to eq("/fields/enumerate/#{page}")
12
+ end
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: administrate-field-enumerate
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jônatas Rancan
8
+ - Andrei Bondarev
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2018-04-17 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: administrate
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: enumerate_it
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :runtime
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rails
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '4.2'
49
+ - - "<"
50
+ - !ruby/object:Gem::Version
51
+ version: '6.0'
52
+ type: :runtime
53
+ prerelease: false
54
+ version_requirements: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ version: '4.2'
59
+ - - "<"
60
+ - !ruby/object:Gem::Version
61
+ version: '6.0'
62
+ description: enumerate_it field plugin for Administrate
63
+ email:
64
+ - hello@sourcelabs.io
65
+ executables: []
66
+ extensions: []
67
+ extra_rdoc_files: []
68
+ files:
69
+ - Gemfile
70
+ - LICENSE.md
71
+ - README.md
72
+ - administrate-field-enumerate.gemspec
73
+ - app/views/fields/enumerate/_form.html.erb
74
+ - app/views/fields/enumerate/_index.html.erb
75
+ - app/views/fields/enumerate/_show.html.erb
76
+ - lib/administrate/field/enumerate.rb
77
+ - spec/lib/administrate/field/enumerate_spec.rb
78
+ homepage: https://github.com/SourceLabsLLC/administrate-field-enumerate
79
+ licenses:
80
+ - MIT
81
+ metadata: {}
82
+ post_install_message:
83
+ rdoc_options: []
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ required_rubygems_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ requirements: []
97
+ rubyforge_project:
98
+ rubygems_version: 2.7.3
99
+ signing_key:
100
+ specification_version: 4
101
+ summary: enumerate_it field plugin for Administrate
102
+ test_files:
103
+ - spec/lib/administrate/field/enumerate_spec.rb