attributes_for 0.4.0 → 0.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +14 -9
- data/app/helpers/attributes_for/attributes_for_helper.rb +2 -2
- data/attributes_for.gemspec +2 -1
- data/lib/attributes_for.rb +1 -0
- data/lib/attributes_for/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a5438a6939910bfcc348ce1efbdb9ba3f7b0044
|
4
|
+
data.tar.gz: 27f5e9b54784398d910bca25b0ee1b7b6a96188d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d0b79c5f064e77f0e8b5cea67a46933d3f0d4f4990ea989cdee47f2071e6f25339a529d8fe005ac10bb92a619bc0b6d2a59712729bdf170658bb13bc517c18f
|
7
|
+
data.tar.gz: 81652bc0d703440d0c5ad61ca5ed0f79a8feeb3aca364154cdc43d13aa7fc0b338bb4819e66c426c249b4c38bb5f5febee485344c2dcedb8cf64e6feb6092e1d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.4.1] - 2015-08-18
|
4
|
+
### Added
|
5
|
+
- Use `phony_rails` to format phone numbers.
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
- Zero values for duration not displayed. Now showing '0'.
|
9
|
+
|
3
10
|
## [0.4.0] - 2015-08-07
|
4
11
|
### Added
|
5
12
|
- `duration` helper. Displays and integer in days, hours, minutes and
|
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
|
+
[travis]: https://travis-ci.org/blacktangent/attributes_for
|
2
|
+
[codeclimate]: https://codeclimate.com/github/blacktangent/attributes_for
|
3
|
+
|
1
4
|
# AttributesFor
|
2
5
|
|
3
|
-
[](https://codeclimate.com/github/blacktangent/attributes_for)
|
6
|
+
[][travis]
|
7
|
+
[][codeclimate]
|
8
|
+
[][codeclimate]
|
7
9
|
|
8
|
-
|
10
|
+
ActiveView Helper to present formatted ActiveModel attributes with
|
11
|
+
icons.
|
9
12
|
|
10
13
|
## Installation
|
11
14
|
|
@@ -28,21 +31,23 @@ Run generator to add I18n locales:
|
|
28
31
|
$ rails generate attributes_for:install
|
29
32
|
|
30
33
|
## Screenshot
|
31
|
-

|
32
35
|
|
33
36
|
## Usage
|
34
37
|
|
35
|
-
Present
|
38
|
+
Present attributes using the API in the example below. It can also generate a
|
36
39
|
standard label value pair given an attribute name using the `attribute` method. Arbitrary
|
37
40
|
strings can also be presented using the `string` method.
|
38
41
|
|
39
|
-
```
|
42
|
+
```erb
|
40
43
|
<ul class="list-unstyled">
|
41
44
|
<%= attributes_for @company do |b| %>
|
42
45
|
<li><%= b.attribute :name, class: 'fa fa-building-o' %></li>
|
43
46
|
<li><%= b.phone :phone %></li>
|
47
|
+
<li><%= b.phone :fax, class: 'fa fa-fax' %></li>
|
44
48
|
<li><%= b.email :email %></li>
|
45
|
-
<li><%= b.
|
49
|
+
<li><%= b.email :support_email %></li>
|
50
|
+
<li><%= b.url :website, id: :site %></li>
|
46
51
|
<li>
|
47
52
|
<%= b.attribute(:user, class: 'fa fa-user') do %>
|
48
53
|
<%= link_to @company.user_name, url_for(@company.user) %>
|
@@ -38,11 +38,11 @@ module AttributesFor
|
|
38
38
|
when :date
|
39
39
|
I18n.l(value, format: options[:format])
|
40
40
|
when :duration
|
41
|
-
ChronicDuration.output(value)
|
41
|
+
ChronicDuration.output(value, :keep_zero => true)
|
42
42
|
when :email
|
43
43
|
mail_to(" #{value}", value, title: human_name(attribute_name))
|
44
44
|
when :phone
|
45
|
-
link_to(" #{
|
45
|
+
link_to(" #{value.to_s.phony_formatted(:format => :international)}", "tel:+#{value}", title: human_name(attribute_name))
|
46
46
|
when :url
|
47
47
|
link_to(" #{value}", value, title: human_name(attribute_name))
|
48
48
|
else
|
data/attributes_for.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Ole J. Rosendahl"]
|
10
10
|
spec.email = ["ole.johnny.rosendahl@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = "Helper
|
12
|
+
spec.summary = "ActiveView Helper to present formatted ActiveModel attributes with icons."
|
13
13
|
spec.description = spec.summary
|
14
14
|
spec.homepage = "https://github.com/blacktangent/attributes_for"
|
15
15
|
spec.license = "MIT"
|
@@ -27,4 +27,5 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.add_dependency 'rails', '~> 4.0'
|
28
28
|
spec.add_dependency 'font-awesome-rails', '~> 4.0'
|
29
29
|
spec.add_dependency 'chronic_duration', '~> 0.10'
|
30
|
+
spec.add_dependency 'phony_rails', '~> 0.12'
|
30
31
|
end
|
data/lib/attributes_for.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attributes_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ole J. Rosendahl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,21 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.10'
|
97
|
-
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: phony_rails
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0.12'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0.12'
|
111
|
+
description: ActiveView Helper to present formatted ActiveModel attributes with icons.
|
98
112
|
email:
|
99
113
|
- ole.johnny.rosendahl@gmail.com
|
100
114
|
executables: []
|
@@ -145,5 +159,5 @@ rubyforge_project:
|
|
145
159
|
rubygems_version: 2.4.7
|
146
160
|
signing_key:
|
147
161
|
specification_version: 4
|
148
|
-
summary: Helper
|
162
|
+
summary: ActiveView Helper to present formatted ActiveModel attributes with icons.
|
149
163
|
test_files: []
|