attributes_for 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +6 -0
- data/README.md +1 -0
- data/app/helpers/attributes_for/attributes_for_helper.rb +10 -2
- data/attributes_for.gemspec +2 -0
- data/lib/attributes_for.rb +1 -1
- data/lib/attributes_for/version.rb +1 -1
- data/lib/generators/attributes_for/install_generator.rb +13 -0
- data/lib/generators/attributes_for/templates/attributes_for.en.yml +5 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fbe5caa06296a883ff1be0b0aef988668c71c94d
|
4
|
+
data.tar.gz: 446b2c7ea7b75df3a1d477ea6188e9498a0381a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 562b36098e0dcd9f39ef1c447246ab7c6e1153ced1c003f9ca19cf6cad93201d4801a16ab801637895af587bd5192da307015394c7158f80c9c0989d8310e25a
|
7
|
+
data.tar.gz: 40af89eccc208a8f45e3a8ab303f064aae50cb5a586f6bba7a5f4148d5c48bfb38fb73fdc53f98c220c5bdc954486528be353977438c0286f79e02fb12ef6ae5
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.2.0] - 2015-08-04
|
4
|
+
### Added
|
5
|
+
- `boolean` formatting helper, will show 'Yes' or 'No' depending on
|
6
|
+
attribute value.
|
7
|
+
- Install generator. Copies locales into project.
|
8
|
+
|
3
9
|
## [0.1.1] - 2015-08-04
|
4
10
|
### Fixed
|
5
11
|
- Disabeling label with format helpers shows unescaped HTML.
|
data/README.md
CHANGED
@@ -37,6 +37,7 @@ strings can also be presented using the `string` method.
|
|
37
37
|
<li><%= b.url :website %></li>
|
38
38
|
<li><%= b.date :created_at %></li>
|
39
39
|
<li><%= b.attribute :credit_rating %></li>
|
40
|
+
<li><%= b.boolean :active %></li>
|
40
41
|
<li><%= b.string "A string" %></li>
|
41
42
|
<% end %>
|
42
43
|
</ul>
|
@@ -15,6 +15,14 @@ module AttributesFor
|
|
15
15
|
@object = object
|
16
16
|
end
|
17
17
|
|
18
|
+
def boolean(attribute_name, options = {})
|
19
|
+
options[:class] ||= 'fa fa-check'
|
20
|
+
|
21
|
+
content(attribute_name, options) do |value|
|
22
|
+
I18n.t("attributes_for.#{value.to_s}")
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
18
26
|
def phone(attribute_name, options = {})
|
19
27
|
options[:class] ||= 'fa fa-phone'
|
20
28
|
|
@@ -67,8 +75,8 @@ module AttributesFor
|
|
67
75
|
end
|
68
76
|
|
69
77
|
def prepare_value(value, &block)
|
70
|
-
if
|
71
|
-
I18n.t
|
78
|
+
if value.to_s.empty?
|
79
|
+
I18n.t "attributes_for.not_set"
|
72
80
|
elsif block_given?
|
73
81
|
yield value
|
74
82
|
else
|
data/attributes_for.gemspec
CHANGED
@@ -18,6 +18,8 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib", "app"]
|
20
20
|
|
21
|
+
spec.required_ruby_version = '~> 2.0'
|
22
|
+
|
21
23
|
spec.add_development_dependency "bundler", "~> 1.10"
|
22
24
|
spec.add_development_dependency "rake", "~> 10.0"
|
23
25
|
spec.add_development_dependency "rspec", "~> 2.3"
|
data/lib/attributes_for.rb
CHANGED
@@ -0,0 +1,13 @@
|
|
1
|
+
module AttributesFor
|
2
|
+
module Generators
|
3
|
+
class InstallGenerator < Rails::Generators::Base
|
4
|
+
desc "Copy AttributesFor translations"
|
5
|
+
source_root File.expand_path('../templates', __FILE__)
|
6
|
+
|
7
|
+
def copy_translations
|
8
|
+
copy_file 'attributes_for.en.yml', 'config/locales/attributes_for.en.yml'
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributes_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ole J. Rosendahl
|
@@ -103,6 +103,8 @@ files:
|
|
103
103
|
- lib/attributes_for.rb
|
104
104
|
- lib/attributes_for/engine.rb
|
105
105
|
- lib/attributes_for/version.rb
|
106
|
+
- lib/generators/attributes_for/install_generator.rb
|
107
|
+
- lib/generators/attributes_for/templates/attributes_for.en.yml
|
106
108
|
homepage: https://github.com/blacktangent/attributes_for
|
107
109
|
licenses:
|
108
110
|
- MIT
|
@@ -114,9 +116,9 @@ require_paths:
|
|
114
116
|
- app
|
115
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
116
118
|
requirements:
|
117
|
-
- - "
|
119
|
+
- - "~>"
|
118
120
|
- !ruby/object:Gem::Version
|
119
|
-
version: '0'
|
121
|
+
version: '2.0'
|
120
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
123
|
requirements:
|
122
124
|
- - ">="
|