actionview-data 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README.rdoc +5 -0
  2. data/actionview-data.rb +7 -1
  3. metadata +4 -4
@@ -5,6 +5,11 @@ HTML5 data attribute helpers for ActionView.
5
5
  tag 'a', nil, :data => { :string => "hi", :number => 1, array => [1, 2, 3], :hash => { :k => 'v' } }
6
6
  # <a data-array="[1,2,3]" data-hash="{&quot;k&quot;:&quot;v&quot;}" data-number="1" data-string="hi"/>
7
7
 
8
+
9
+ This patch
10
+ {is in Rails 3.1}[https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/5825-html5-data-attributes].
11
+
12
+
8
13
  == Install
9
14
 
10
15
  # Gemfile
@@ -6,7 +6,13 @@ ActionView::Helpers::TagHelper.module_eval do
6
6
  attrs = []
7
7
  options.each_pair do |key, value|
8
8
  if key.to_s == 'data' && value.is_a?(Hash)
9
- value.each { |k, v| attrs << %(data-#{k}="#{ERB::Util.h(v.is_a?(String) ? v : v.to_json)}") }
9
+ value.each_pair do |k, v|
10
+ if !v.is_a?(String) && !v.is_a?(Symbol)
11
+ v = v.to_json
12
+ end
13
+ v = html_escape(v) if escape
14
+ attrs << %(data-#{k.to_s.dasherize}="#{v}")
15
+ end
10
16
  elsif BOOLEAN_ATTRIBUTES.include?(key)
11
17
  attrs << %(#{key}="#{key}") if value
12
18
  elsif !value.nil?
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 3
7
7
  - 0
8
- - 0
9
- version: 3.0.0
8
+ - 1
9
+ version: 3.0.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Stephen Celis
@@ -14,11 +14,11 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-16 00:00:00 -05:00
17
+ date: 2010-10-29 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
- name: activesupport
21
+ name: actionpack
22
22
  prerelease: false
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false