data_attributes 1.0.0 → 1.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.
- checksums.yaml +4 -4
- data/README.mdown +4 -10
- data/VERSION +1 -1
- data/data_attributes.gemspec +2 -2
- data/lib/data_attributes.rb +9 -1
- data/lib/data_attributes/{view.rb → helper.rb} +1 -1
- data/spec/data_attributes/{view_spec.rb → helper_spec.rb} +1 -1
- data/spec/support/mocks/view.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0cc393de9a1b6b73a2bda2ba0dd35359340660b
|
4
|
+
data.tar.gz: e17a7fdeddc2c3af32650e3443b00927fe5a777f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e215cc000eac4d61afcad275358d02123f5a283034dc482e727e4701623d498fea5f363d036063772e03b29e18a6dcb0a3437bc08000e46d817bce2610362ce
|
7
|
+
data.tar.gz: 832ef5059dd1689b8804888bc835fad538a66ab7c3491734a5ced1dadacc223f17861f90d48b64f4811a81d50bfa93cdfd8ac3402ce71ea6c05d18dc424fdb38
|
data/README.mdown
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# DataAttributes
|
2
2
|
|
3
|
-
|
4
|
-
from model to view.
|
3
|
+
A gem to provide [HTML data attributes](https://developer.mozilla.org/en-US/docs/Learn/HTML/Howto/Use_data_attributes)
|
4
|
+
easily from model to view.
|
5
5
|
|
6
6
|
## Setup
|
7
7
|
|
@@ -45,15 +45,9 @@ class Article
|
|
45
45
|
end
|
46
46
|
```
|
47
47
|
|
48
|
-
|
48
|
+
Note that `DataAttributes::Model` mixin is automatically added into
|
49
|
+
`ActiveRecord::Base` (if present).
|
49
50
|
|
50
|
-
```ruby
|
51
|
-
module ApplicationHelper
|
52
|
-
|
53
|
-
include DataAttribute::View
|
54
|
-
|
55
|
-
end
|
56
|
-
```
|
57
51
|
|
58
52
|
Then `content_tag_for` and `div_for` methods from [record_tag_helper](https://rubygems.org/gems/record_tag_helper)
|
59
53
|
gem will add model's data attributes into view:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/data_attributes.gemspec
CHANGED
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
|
|
5
5
|
s.author = 'Alexis Toulotte'
|
6
6
|
s.email = 'al@alweb.org'
|
7
7
|
s.homepage = 'https://github.com/alexistoulotte/data_attributes'
|
8
|
-
s.summary = '
|
9
|
-
s.description = '
|
8
|
+
s.summary = 'Provides HTML data attributes from model to view'
|
9
|
+
s.description = 'A gem to provide HTML data attributes from model to view'
|
10
10
|
s.license = 'MIT'
|
11
11
|
|
12
12
|
s.files = `git ls-files`.split("\n")
|
data/lib/data_attributes.rb
CHANGED
@@ -5,4 +5,12 @@ require 'active_support/json'
|
|
5
5
|
lib_path = "#{__dir__}/data_attributes"
|
6
6
|
|
7
7
|
require "#{lib_path}/model"
|
8
|
-
require "#{lib_path}/
|
8
|
+
require "#{lib_path}/helper"
|
9
|
+
|
10
|
+
ActiveSupport.on_load(:action_view) do
|
11
|
+
include DataAttributes::Helper
|
12
|
+
end
|
13
|
+
|
14
|
+
ActiveSupport.on_load(:active_record) do
|
15
|
+
ActiveRecord::Base.send(:include, DataAttributes::Model)
|
16
|
+
end
|
data/spec/support/mocks/view.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_attributes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexis Toulotte
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 3.6.0
|
93
|
-
description:
|
93
|
+
description: A gem to provide HTML data attributes from model to view
|
94
94
|
email: al@alweb.org
|
95
95
|
executables: []
|
96
96
|
extensions: []
|
@@ -105,11 +105,11 @@ files:
|
|
105
105
|
- VERSION
|
106
106
|
- data_attributes.gemspec
|
107
107
|
- lib/data_attributes.rb
|
108
|
+
- lib/data_attributes/helper.rb
|
108
109
|
- lib/data_attributes/model.rb
|
109
|
-
- lib/data_attributes/view.rb
|
110
110
|
- lib/spec_helper.rb
|
111
|
+
- spec/data_attributes/helper_spec.rb
|
111
112
|
- spec/data_attributes/model_spec.rb
|
112
|
-
- spec/data_attributes/view_spec.rb
|
113
113
|
- spec/spec_helper.rb
|
114
114
|
- spec/support/mocks/article.rb
|
115
115
|
- spec/support/mocks/category.rb
|
@@ -138,10 +138,10 @@ rubyforge_project:
|
|
138
138
|
rubygems_version: 2.5.2
|
139
139
|
signing_key:
|
140
140
|
specification_version: 4
|
141
|
-
summary:
|
141
|
+
summary: Provides HTML data attributes from model to view
|
142
142
|
test_files:
|
143
|
+
- spec/data_attributes/helper_spec.rb
|
143
144
|
- spec/data_attributes/model_spec.rb
|
144
|
-
- spec/data_attributes/view_spec.rb
|
145
145
|
- spec/spec_helper.rb
|
146
146
|
- spec/support/mocks/article.rb
|
147
147
|
- spec/support/mocks/category.rb
|