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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 988286109b948ecd2c576382e222f1e28d1bf060
4
- data.tar.gz: aa59bf132c8103854641a7b7dd52493bb931204c
2
+ SHA256:
3
+ metadata.gz: b5258d9faae0951e8c10c98263ebf9a2c15d26a0c6c9b266eddfbd3d553411f7
4
+ data.tar.gz: '00892324cc16748492b4cf2ab07b2e59d83759c853a26e2474ed7e712fbb0208'
5
5
  SHA512:
6
- metadata.gz: c6161d3de8c14446defd186869f3af315bd381f921034d13a7cf4c28f0f6139c72a143f492a5fef879751aa2e7252d54ebfb7369770896fa0037db10e4ec14ba
7
- data.tar.gz: 32965c8e7a2e70e6bda8b0650e38be0a97851d591e4c950a0f6b3deed3aa054a694c3e7d37e7b6fb405f836c00e7adfc175a8147d6617df38424a642279d1043
6
+ metadata.gz: 284fbd9569b88839ce2eeb95f987aca756f79e0508e37ac4559cb52a13842a9ca9f6c4519fb8eaf6ae0564574e253d39030e5ce72b04942e6ddfc8996f725e21
7
+ data.tar.gz: eafb48303cfe3b8b7dd994e756cdfc7798e5b1c88c8c2acda5e0c6894d87573ff946896dccb0d30cc97ebb2fae22e703977f5e4a0336b051c867de0a57a5e2a3
data/README.md CHANGED
@@ -1,33 +1,35 @@
1
- # Administrate::Field::Enum
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
- 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.
6
+ ## Installation
8
7
 
9
- ## FAQs
8
+ Add this line to your application's Gemfile:
10
9
 
11
- **Q: How should I name my gem?**
10
+ ```ruby
11
+ gem 'administrate-field-enum'
12
+ ```
12
13
 
13
- A: Administrate field gems must be named according to the [Rubygems naming guidelines].
14
+ And then execute:
15
+ ```
16
+ $ bundle install
17
+ ```
14
18
 
15
- Essentially, name your gem after the field class that it defines.
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
- Since all administrate field gems are under the namespace `Administrate::Field`,
20
- every field gem name should start with the prefix `administrate-field-`.
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
- Here are some examples (these don't correspond to actual gems):
28
+ ## Contributing
23
29
 
24
- | Gem Name | Field Name |
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
- [Rubygems naming guidelines]: http://guides.rubygems.org/name-your-gem/
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.4'
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
- f.object.class.public_send(field.attribute.to_s.pluralize)
25
- .map { |k, v| [k.humanize, k] },
26
- f.object.public_send(field.attribute.to_s)),
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
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: 2017-06-07 00:00:00.000000000 Z
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.5.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: