easy_table 0.0.6 → 0.0.7
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/.travis.yml +3 -0
- data/Gemfile +3 -5
- data/README.md +4 -1
- data/circle.yml +4 -0
- data/easy_table.gemspec +2 -2
- data/lib/easy_table/components/column.rb +2 -2
- data/lib/easy_table/table_builder.rb +2 -2
- data/lib/easy_table/version.rb +2 -1
- data/test/action_view_extensions/table_helper_test.rb +8 -8
- data/test/test_helper.rb +2 -2
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 06cd4406049ffdbb97b4f911cb5c41f7db72baf2
|
4
|
+
data.tar.gz: 78b2c931f5ce74e38133dbc3f803b880c9e4ac9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0bee4f837196dc477947941568cc6725fc09e8df36b56d96bfb6fde61cbf2d24fddf145bc3b632132b310aa1df8479d89772210d11d2ab23c5640968fdfbbb
|
7
|
+
data.tar.gz: f04130557ae9129caef5a0474bfe1ea49f0343f0b01f311ea6b7bcd9ab2195433ba4c163c002a9aca32da13f88a56ff280fca2056db5947b711ca1dca6e53083
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# EasyTable
|
2
2
|
|
3
3
|
[](https://travis-ci.org/cthulhu666/easy_table)
|
4
|
+
[](https://coderwall.com/cthulhu666)
|
4
5
|
|
5
6
|
EasyTable provides a helper for building HTML tables in Rails applications.
|
6
7
|
|
@@ -18,7 +19,9 @@ And then execute:
|
|
18
19
|
|
19
20
|
## Usage
|
20
21
|
|
21
|
-
|
22
|
+
For a working Rails 4.2 sample code see: [cthulhu666/easy_table_sample](https://github.com/cthulhu666/easy_table_sample/tree/rails_4_2)
|
23
|
+
|
24
|
+
All examples below assume that You are using Haml. Please, use Haml !
|
22
25
|
|
23
26
|
### Simplest example
|
24
27
|
|
data/circle.yml
ADDED
data/easy_table.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = EasyTable::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'activemodel', '~> 4.
|
19
|
-
gem.add_dependency 'actionpack', '~> 4.
|
18
|
+
gem.add_dependency 'activemodel', '~> 4.2'
|
19
|
+
gem.add_dependency 'actionpack', '~> 4.2'
|
20
20
|
gem.add_dependency 'rubytree', '~> 0.8.3'
|
21
21
|
end
|
@@ -7,8 +7,8 @@ module EasyTable
|
|
7
7
|
|
8
8
|
def initialize(node, title, label, opts, template, block)
|
9
9
|
@node, @title, @label, @template, @block, @opts = node, title, label, template, block, opts
|
10
|
-
header_opts = @opts.select { |k,
|
11
|
-
header_opts.each { |k,
|
10
|
+
header_opts = @opts.select { |k, _v| k =~ /^header_.*/ }
|
11
|
+
header_opts.each { |k, _v| @opts.delete(k) }
|
12
12
|
@header_opts = header_opts.inject({}) do |h, e|
|
13
13
|
k, v = *e
|
14
14
|
h[k[7..-1]] = v
|
@@ -9,8 +9,8 @@ module EasyTable
|
|
9
9
|
def initialize(collection, template, options)
|
10
10
|
@collection = collection
|
11
11
|
@options = options
|
12
|
-
tr_opts = @options.select { |k,
|
13
|
-
tr_opts.each { |k,
|
12
|
+
tr_opts = @options.select { |k, _v| k =~ /^tr_.*/ }
|
13
|
+
tr_opts.each { |k, _v| @options.delete(k) }
|
14
14
|
@tr_opts = tr_opts.inject({}) do |h, e|
|
15
15
|
k, v = *e
|
16
16
|
h[k[3..-1]] = v
|
data/lib/easy_table/version.rb
CHANGED
@@ -11,7 +11,7 @@ class TableHelperTest < ActionView::TestCase
|
|
11
11
|
@collection = ['foo', 'bar', 'buzz']
|
12
12
|
concat(table_for(@collection, class: 'easy') do |t|
|
13
13
|
t.column :downcase
|
14
|
-
t.column(:upcase) { |
|
14
|
+
t.column(:upcase) { |e| e.upcase }
|
15
15
|
end)
|
16
16
|
end
|
17
17
|
|
@@ -31,7 +31,7 @@ class TableHelperTest < ActionView::TestCase
|
|
31
31
|
|
32
32
|
should "have proper headers" do
|
33
33
|
headers = css_select 'table thead tr th'
|
34
|
-
assert_equal '<th>downcase</th>', headers[0].to_s
|
34
|
+
assert_equal '<th>downcase</th>', headers[0].to_s.strip
|
35
35
|
assert_equal '<th>upcase</th>', headers[1].to_s
|
36
36
|
end
|
37
37
|
end
|
@@ -76,22 +76,22 @@ class TableHelperTest < ActionView::TestCase
|
|
76
76
|
|
77
77
|
should "have proper td class in name column" do
|
78
78
|
td = css_select('table tbody tr:first-child td:first-child').first
|
79
|
-
assert_equal 'name', td.attributes['class']
|
79
|
+
assert_equal 'name', td.attributes['class'].value
|
80
80
|
end
|
81
81
|
|
82
82
|
should "have proper th class in name column" do
|
83
83
|
td = css_select('table thead tr:nth-child(2) th:first-child').first
|
84
|
-
assert_equal 'name_head', td.attributes['class']
|
84
|
+
assert_equal 'name_head', td.attributes['class'].value
|
85
85
|
end
|
86
86
|
|
87
87
|
should "have proper td class in first row in email column" do
|
88
88
|
td = css_select('table tbody tr:nth-child(1) td:nth-child(3)').first
|
89
|
-
assert_equal 'foo bar gmail', td.attributes['class']
|
89
|
+
assert_equal 'foo bar gmail', td.attributes['class'].value
|
90
90
|
end
|
91
91
|
|
92
92
|
should "have proper td class in second row in email column" do
|
93
93
|
td = css_select('table tbody tr:nth-child(2) td:nth-child(3)').first
|
94
|
-
assert_equal 'foo bar', td.attributes['class']
|
94
|
+
assert_equal 'foo bar', td.attributes['class'].value
|
95
95
|
end
|
96
96
|
end
|
97
97
|
|
@@ -125,11 +125,11 @@ class TableHelperTest < ActionView::TestCase
|
|
125
125
|
|
126
126
|
should "have rowspan=3 in last th of first tr" do
|
127
127
|
th = css_select('table thead tr:first-child th:last-child').first
|
128
|
-
assert_equal '3', th.attributes['rowspan']
|
128
|
+
assert_equal '3', th.attributes['rowspan'].value
|
129
129
|
end
|
130
130
|
|
131
131
|
should "have 11 th elements in thead" do
|
132
132
|
assert_select 'table thead th', count: 11
|
133
133
|
end
|
134
134
|
end
|
135
|
-
end
|
135
|
+
end
|
data/test/test_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
|
-
require '
|
4
|
+
require 'minitest/autorun'
|
5
5
|
require 'mocha/setup'
|
6
6
|
|
7
7
|
require 'active_model'
|
@@ -27,4 +27,4 @@ I18n.default_locale = :en
|
|
27
27
|
class ActionView::TestCase
|
28
28
|
include EasyTable::ActionViewExtensions::TableHelper
|
29
29
|
|
30
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jakub Głuszecki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '4.
|
19
|
+
version: '4.2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '4.
|
26
|
+
version: '4.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionpack
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '4.
|
33
|
+
version: '4.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '4.
|
40
|
+
version: '4.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rubytree
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,10 +60,12 @@ extensions: []
|
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
62
|
- ".gitignore"
|
63
|
+
- ".travis.yml"
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE
|
65
66
|
- README.md
|
66
67
|
- Rakefile
|
68
|
+
- circle.yml
|
67
69
|
- easy_table.gemspec
|
68
70
|
- lib/easy_table.rb
|
69
71
|
- lib/easy_table/action_view_extensions/table_helper.rb
|
@@ -97,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
99
|
version: '0'
|
98
100
|
requirements: []
|
99
101
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.
|
102
|
+
rubygems_version: 2.4.8
|
101
103
|
signing_key:
|
102
104
|
specification_version: 4
|
103
105
|
summary: HTML tables made easy (in Rails 4)
|