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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b5ce46b00c35f4c575e32426c6cb3ef0e24b6401
4
- data.tar.gz: 2304e39bc30bcc62ec8e682f223ba906b00af16a
3
+ metadata.gz: 0a5438a6939910bfcc348ce1efbdb9ba3f7b0044
4
+ data.tar.gz: 27f5e9b54784398d910bca25b0ee1b7b6a96188d
5
5
  SHA512:
6
- metadata.gz: 37f9c9ca4406e6cebd13ff2a72536b41d7e9142d85fee57363d49ea5f8b927095a1cc680b548ec261f3dc5d932f2646fd02414b91544e8994ff26750f8ffe372
7
- data.tar.gz: 934b04a52d750bc0ba16c1e92b02404b3701aa0a7fe36a34126f3e9a313380f90f00c88b8d89ef711cf2e88274ce967c5a82dcad95e0f85c0a5338dfdc0c6d54
6
+ metadata.gz: 6d0b79c5f064e77f0e8b5cea67a46933d3f0d4f4990ea989cdee47f2071e6f25339a529d8fe005ac10bb92a619bc0b6d2a59712729bdf170658bb13bc517c18f
7
+ data.tar.gz: 81652bc0d703440d0c5ad61ca5ed0f79a8feeb3aca364154cdc43d13aa7fc0b338bb4819e66c426c249b4c38bb5f5febee485344c2dcedb8cf64e6feb6092e1d
@@ -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
- [![Build
4
- Status](https://travis-ci.org/blacktangent/attributes_for.svg?branch=master)](https://travis-ci.org/blacktangent/attributes_for)
5
- [![Code
6
- Climate](https://codeclimate.com/github/blacktangent/attributes_for.png)](https://codeclimate.com/github/blacktangent/attributes_for)
6
+ [![Build Status](https://travis-ci.org/blacktangent/attributes_for.svg?branch=master)][travis]
7
+ [![Code Climate](https://codeclimate.com/github/blacktangent/attributes_for/badges/gpa.svg)][codeclimate]
8
+ [![Test Coverage](https://codeclimate.com/github/blacktangent/attributes_for/badges/coverage.svg)][codeclimate]
7
9
 
8
- Easily present formatted ActiveModel attributes with translated label and an optional icon.
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
- ![Screenshot](https://cloud.githubusercontent.com/assets/1222916/9128630/e3bf2cda-3cf5-11e5-804b-c481734d0197.png)
34
+ ![Screenshot](https://cloud.githubusercontent.com/assets/1222916/9355402/295b6324-46a3-11e5-9f8c-ff864b837cdd.png)
32
35
 
33
36
  ## Usage
34
37
 
35
- Present the attributes using the API in the example below. It can also generate a
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
- ```ruby
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.url :website %></li>
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(" #{number_to_phone(value)}", "tel:#{value}", title: human_name(attribute_name))
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
@@ -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 for displaying model attributes with icons"
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
@@ -3,6 +3,7 @@ require "rails/engine"
3
3
  require "action_view"
4
4
  require "attributes_for/engine"
5
5
  require "helpers/attributes_for/attributes_for_helper"
6
+ require "phony_rails"
6
7
 
7
8
  module AttributesFor
8
9
  # Your code goes here...
@@ -1,3 +1,3 @@
1
1
  module AttributesFor
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
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.0
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-10 00:00:00.000000000 Z
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
- description: Helper for displaying model attributes with icons
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 for displaying model attributes with icons
162
+ summary: ActiveView Helper to present formatted ActiveModel attributes with icons.
149
163
  test_files: []