administrate-field-enum 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +23 -21
- data/administrate-field-enum.gemspec +1 -1
- data/app/views/fields/enum/_form.html.erb +5 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b5258d9faae0951e8c10c98263ebf9a2c15d26a0c6c9b266eddfbd3d553411f7
|
4
|
+
data.tar.gz: '00892324cc16748492b4cf2ab07b2e59d83759c853a26e2474ed7e712fbb0208'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 284fbd9569b88839ce2eeb95f987aca756f79e0508e37ac4559cb52a13842a9ca9f6c4519fb8eaf6ae0564574e253d39030e5ce72b04942e6ddfc8996f725e21
|
7
|
+
data.tar.gz: eafb48303cfe3b8b7dd994e756cdfc7798e5b1c88c8c2acda5e0c6894d87573ff946896dccb0d30cc97ebb2fae22e703977f5e4a0336b051c867de0a57a5e2a3
|
data/README.md
CHANGED
@@ -1,33 +1,35 @@
|
|
1
|
-
|
1
|
+
## AdministrateFieldEnum
|
2
|
+
[![Gem](https://img.shields.io/gem/v/administrate-field-enum.svg)]()
|
2
3
|
|
3
4
|
A plugin to show enum attributes in [Administrate].
|
4
5
|
|
5
|
-
|
6
|
-
Although its structure may change,
|
7
|
-
it's designed to act as a template for other Administrate field plugins.
|
6
|
+
## Installation
|
8
7
|
|
9
|
-
|
8
|
+
Add this line to your application's Gemfile:
|
10
9
|
|
11
|
-
|
10
|
+
```ruby
|
11
|
+
gem 'administrate-field-enum'
|
12
|
+
```
|
12
13
|
|
13
|
-
|
14
|
+
And then execute:
|
15
|
+
```
|
16
|
+
$ bundle install
|
17
|
+
```
|
14
18
|
|
15
|
-
|
16
|
-
If there's a namespace in the class name, that gets translated to a dash (`-`) in the gem name.
|
17
|
-
If the class name is CamelCased, that translates to an underscore (`_`) in the gem name.
|
19
|
+
## Usage
|
18
20
|
|
19
|
-
|
20
|
-
|
21
|
+
In your Dashboard `ATTRIBUTE_TYPES` use the field type `Field::Enum`. i.e.
|
22
|
+
```ruby
|
23
|
+
ATTRIBUTE_TYPES = {
|
24
|
+
category: Field::Enum
|
25
|
+
}
|
26
|
+
```
|
21
27
|
|
22
|
-
|
28
|
+
## Contributing
|
23
29
|
|
24
|
-
|
25
|
-
|----------------------------|------------------------------|
|
26
|
-
| `administrate-field-enum` | `Administrate::Field::Enum` |
|
27
|
-
| `administrate-field-file_upload` | `Administrate::Field::FileUpload` |
|
28
|
-
| `administrate-field-geocoding-region` | `Administrate::Field::Geocoding::Region` |
|
29
|
-
| `administrate-field-geocoding-geo_json` | `Administrate::Field::Geocoding::GeoJson` |
|
30
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/DisruptiveAngels/administrate-field-enum.
|
30
31
|
|
31
|
-
|
32
|
+
## License
|
33
|
+
|
34
|
+
[MIT License](https://github.com/DisruptiveAngels/administrate-field-enum/blob/master/LICENSE.md)
|
32
35
|
|
33
|
-
[Administrate]: https://github.com/thoughtbot/administrate
|
@@ -2,7 +2,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'administrate-field-enum'
|
5
|
-
s.version = '0.0.
|
5
|
+
s.version = '0.0.6'
|
6
6
|
s.authors = ['Balbina Santana', 'Adrian Rangel']
|
7
7
|
s.email = ['adrian@disruptiveangels.com']
|
8
8
|
s.homepage = 'https://github.com/DisruptiveAngels/administrate-field-enum'
|
@@ -21,8 +21,10 @@ By default, the input is a select field for the enum attributes.
|
|
21
21
|
<%= f.select(
|
22
22
|
field.attribute,
|
23
23
|
options_for_select(
|
24
|
-
|
25
|
-
|
26
|
-
|
24
|
+
f.object.class.public_send(field.attribute.to_s.pluralize).map do |k, v|
|
25
|
+
[I18n.t("activerecord.attributes.#{f.object.class.name.underscore}.#{field.attribute.to_s.pluralize}.#{k}", default: k.humanize), k]
|
26
|
+
end,
|
27
|
+
f.object.public_send(field.attribute.to_s)
|
28
|
+
),
|
27
29
|
include_blank: false) %>
|
28
30
|
</div>
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: administrate-field-enum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Balbina Santana
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2018-03-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: administrate
|
@@ -81,10 +81,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
81
81
|
version: '0'
|
82
82
|
requirements: []
|
83
83
|
rubyforge_project:
|
84
|
-
rubygems_version: 2.
|
84
|
+
rubygems_version: 2.7.3
|
85
85
|
signing_key:
|
86
86
|
specification_version: 4
|
87
87
|
summary: Enum field plugin for Administrate
|
88
88
|
test_files:
|
89
89
|
- spec/lib/administrate/field/enum_spec.rb
|
90
|
-
has_rdoc:
|