active_admin-humanized_enum 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 350c2b1355ac505f700949d1589396b013444959
4
+ data.tar.gz: 7f2219d7b5ee1296e0dee4d53010a791472c81c8
5
+ SHA512:
6
+ metadata.gz: f26aa6d0ca35a5ffe40018f7b24be63c94d83ce8c3c9265e21e6e5bb498ff7093157984f8d24d8fc84d076367927eb6baad079eba00f747811f8e39437c78af9
7
+ data.tar.gz: a6a1029cbde7fcad5774170e990a828700b74a23a7200fdbac3528a0f1c9fe1f20411af126aeb63240bbc213ad3cced410b63d9357414258d32acb4a1d5bb8ce
@@ -0,0 +1,13 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = false
@@ -0,0 +1,4 @@
1
+ pkg
2
+ doc
3
+ log
4
+ *.lock
@@ -0,0 +1,39 @@
1
+ # Contributing
2
+
3
+ ## Issues
4
+
5
+ If you want to request a feature or report a bug, please use the following template.
6
+
7
+ ```markdown
8
+ ## Description
9
+
10
+ [Add feature/bug description here]
11
+
12
+ ## How to reproduce
13
+
14
+ [Add steps on how to reproduce this issue]
15
+
16
+ ## What do you expect
17
+
18
+ [Describe what do you expect to happen]
19
+
20
+ ## What happened instead
21
+
22
+ [Describe the actual results]
23
+
24
+ ## Gem version:
25
+
26
+ Rescuable version: [Add gem version here]
27
+ ```
28
+
29
+ ## Writing code
30
+
31
+ Once you've made your great commits (include tests, please):
32
+
33
+ 1. [Fork](http://help.github.com/forking/) the [original repository](http://github.com/dhyegofernando/rescuable)
34
+ 2. Create a topic branch - `git checkout -b my_branch`
35
+ 3. Push to your branch - `git push origin my_branch`
36
+ 4. [Create an Issue](http://github.com/dhyegofernando/rescuable/issues) with a link to your branch
37
+ 5. That's it!
38
+
39
+ Please respect the code style using [editorconfig](http://editorconfig.org/) in your text editor.
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'http://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in rescuable.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Dhyego Fernando
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
13
+ all 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
21
+ THE SOFTWARE.
@@ -0,0 +1,15 @@
1
+ # ActiveAdmin integration with ActiveRecord Humanized Enum (I18n)
2
+ Easily translate ActiveRecord's enums in your ActiveAdmin.
3
+
4
+ ## Installation
5
+ Include to your Gemfile
6
+ ```ruby
7
+ gem 'active_record-humanized_enum'
8
+ gem 'active_admin-humanized_enum'
9
+ ```
10
+
11
+ ## Usage
12
+ Please take a look how [active_record-humanized_enum](http://github.com/dhyegofernando/active_record-humanized_enum) works and your ActiveAdmin is gonna magically work too.
13
+
14
+ ## Maintainer
15
+ [Dhyego Fernando](https://github.com/dhyegofernando)
@@ -0,0 +1,9 @@
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << 'test'
6
+ t.test_files = FileList['./test/**/*_test.rb']
7
+ end
8
+
9
+ task default: :test
@@ -0,0 +1,23 @@
1
+ require './lib/active_admin/humanized_enum/version'
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'active_admin-humanized_enum'
5
+ spec.version = ActiveAdmin::HumanizedEnum::Version::STRING
6
+ spec.authors = ['Dhyego Fernando']
7
+ spec.email = ['dhyegofernando@gmail.com']
8
+
9
+ spec.summary = 'Easily translate ActiveRecord\'s enums in your ActiveAdmin.'
10
+ spec.description = spec.summary
11
+ spec.homepage = 'http://github.com/dhyegofernando/active_admin-humanized_enum'
12
+ spec.license = 'MIT'
13
+
14
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
15
+
16
+ spec.add_dependency 'activeadmin', '>= 1.0.0.pre1'
17
+
18
+ spec.add_development_dependency 'bundler'
19
+ spec.add_development_dependency 'rake'
20
+ spec.add_development_dependency 'minitest'
21
+ spec.add_development_dependency 'minitest-utils'
22
+ spec.add_development_dependency 'pry-meta'
23
+ end
@@ -0,0 +1,6 @@
1
+ require 'active_admin'
2
+ require 'active_admin/humanized_enum/view_helpers/display_helper'
3
+
4
+ if defined?(ActiveAdmin)
5
+ ActiveAdmin::ViewHelpers.include(ActiveAdmin::HumanizedEnum::ViewHelpers::DisplayHelper)
6
+ end
@@ -0,0 +1,10 @@
1
+ module ActiveAdmin
2
+ module HumanizedEnum
3
+ module Version
4
+ MAJOR = 0
5
+ MINOR = 1
6
+ PATCH = 0
7
+ STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,25 @@
1
+ module ActiveAdmin
2
+ module HumanizedEnum
3
+ module ViewHelpers
4
+ module DisplayHelper
5
+ def format_attribute(resource, attr)
6
+ humanize_value = humanize_enum(resource, attr)
7
+
8
+ if humanize_value
9
+ humanize_value
10
+ else
11
+ super(resource, attr)
12
+ end
13
+ end
14
+
15
+ def humanize_enum(resource, attr)
16
+ case attr
17
+ when String, Symbol
18
+ method = "humanized_#{attr.to_sym.downcase}"
19
+ resource.send(method) if resource.respond_to?(method)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_admin-humanized_enum
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Dhyego Fernando
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-10-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: activeadmin
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0.pre1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 1.0.0.pre1
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest-utils
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry-meta
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: Easily translate ActiveRecord's enums in your ActiveAdmin.
98
+ email:
99
+ - dhyegofernando@gmail.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files: []
103
+ files:
104
+ - ".editorconfig"
105
+ - ".gitignore"
106
+ - CONTRIBUTING.md
107
+ - Gemfile
108
+ - LICENSE
109
+ - README.md
110
+ - Rakefile
111
+ - active_admin-humanized_enum.gemspec
112
+ - lib/active_admin/humanized_enum.rb
113
+ - lib/active_admin/humanized_enum/version.rb
114
+ - lib/active_admin/humanized_enum/view_helpers/display_helper.rb
115
+ homepage: http://github.com/dhyegofernando/active_admin-humanized_enum
116
+ licenses:
117
+ - MIT
118
+ metadata: {}
119
+ post_install_message:
120
+ rdoc_options: []
121
+ require_paths:
122
+ - lib
123
+ required_ruby_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: '0'
133
+ requirements: []
134
+ rubyforge_project:
135
+ rubygems_version: 2.4.8
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: Easily translate ActiveRecord's enums in your ActiveAdmin.
139
+ test_files: []