dining-table 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +3 -3
- data/CHANGELOG.md +8 -0
- data/Gemfile +1 -1
- data/README.md +3 -3
- data/VERSION +1 -1
- data/dining-table.gemspec +8 -8
- data/lib/dining-table/presenters/html_presenter.rb +1 -1
- data/spec/html_table_spec.rb +11 -0
- data/spec/tables/car_table_with_config_blocks.rb +4 -2
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 86007b91ee4155416dab5a0c477f781a77f294892982eebc9dcc2b08dab90f7d
|
4
|
+
data.tar.gz: f7babfb11c2c7e06bb4cdf5a3508ea8450ac529958ff34b427c6a650965d733c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5b0e978e433992578a3faf64dd27d899120a1391ef7b7d1517352867f36c66fb0dc8cfd635aec8491b998bd6954f632a1e1292c732454ff1547dee0b877fd498
|
7
|
+
data.tar.gz: 1c0956e9c3dbf7af598d13b5058e2ff5ac5aaf0e06e8f78fb9945c6fd15ec7e1a1013b4863d83a35bcfd49b9b8fbc8ec94934ffd51428adc90e6af770a6a9dea
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
## 1.1.1 (12/10/2019)
|
2
|
+
|
3
|
+
* Bugfix - call per-cell configuration block with correct index for footer row
|
4
|
+
|
5
|
+
## 1.1.0 (28/11/2018)
|
6
|
+
|
7
|
+
* Allow passing in class of object to avoid header edge case when the collection is empty
|
8
|
+
|
1
9
|
## 1.0.0 (17/06/2018)
|
2
10
|
|
3
11
|
* New configuration mechanism for HTML presenter
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -403,14 +403,14 @@ end
|
|
403
403
|
|
404
404
|
### Excel (xlsx)
|
405
405
|
|
406
|
-
The Excel presenter depends on [axlsx](https://github.com/randym/axlsx). Note that `dining-table` doesn't require `axlsx`, you have to add
|
406
|
+
The Excel presenter depends on [xlsxtream](https://github.com/felixbuenemann/xlsxtream) or [axlsx](https://github.com/randym/axlsx). Note that `dining-table` doesn't require either `xlsxtream` or `axlsx`, you have to add one of them to
|
407
407
|
your Gemfile yourself if you want to use the Excel presenter.
|
408
408
|
|
409
|
-
In order to use the Excel presenter, pass it in as a presenter and provide
|
409
|
+
In order to use the Excel presenter, pass it in as a presenter and provide a xlsxtream or axlsx worksheet:
|
410
410
|
|
411
411
|
```ruby
|
412
412
|
collection = Car.order(:brand)
|
413
|
-
# sheet is the axlsx worksheet in which the table will be rendered
|
413
|
+
# sheet is the xlsxtream or axlsx worksheet in which the table will be rendered
|
414
414
|
CarTable.new( collection, nil, presenter: DiningTable::Presenters::ExcelPresenter.new( sheet ) ).render
|
415
415
|
```
|
416
416
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.1
|
data/dining-table.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: dining-table 1.1.
|
5
|
+
# stub: dining-table 1.1.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "dining-table".freeze
|
9
|
-
s.version = "1.1.
|
9
|
+
s.version = "1.1.1"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
|
-
s.authors = ["Micha\
|
14
|
-
s.date = "
|
13
|
+
s.authors = ["Micha\u00EBl Van Damme".freeze]
|
14
|
+
s.date = "2019-10-12"
|
15
15
|
s.description = "Easily output tabular data, be it in HTML, CSV or XLSX. Create clean table classes instead of messing with views to create nice tables.".freeze
|
16
16
|
s.email = "michael.vandamme@vub.ac.be".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -54,21 +54,21 @@ Gem::Specification.new do |s|
|
|
54
54
|
]
|
55
55
|
s.homepage = "http://github.com/mvdamme/dining-table".freeze
|
56
56
|
s.licenses = ["MIT".freeze]
|
57
|
-
s.rubygems_version = "2.6
|
57
|
+
s.rubygems_version = "2.7.6".freeze
|
58
58
|
s.summary = "Create tables easily. Supports html, csv and xlsx.".freeze
|
59
59
|
|
60
60
|
if s.respond_to? :specification_version then
|
61
61
|
s.specification_version = 4
|
62
62
|
|
63
63
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
64
|
-
s.add_development_dependency(%q<bundler>.freeze, ["
|
64
|
+
s.add_development_dependency(%q<bundler>.freeze, [">= 0"])
|
65
65
|
s.add_development_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
66
66
|
else
|
67
|
-
s.add_dependency(%q<bundler>.freeze, ["
|
67
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
68
68
|
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
69
69
|
end
|
70
70
|
else
|
71
|
-
s.add_dependency(%q<bundler>.freeze, ["
|
71
|
+
s.add_dependency(%q<bundler>.freeze, [">= 0"])
|
72
72
|
s.add_dependency(%q<juwelier>.freeze, ["~> 2.1.0"])
|
73
73
|
end
|
74
74
|
end
|
@@ -77,7 +77,7 @@ module DiningTable
|
|
77
77
|
add_tag(:start, :tr, row_options)
|
78
78
|
columns.each_with_index do |column, index|
|
79
79
|
value = footers[index]
|
80
|
-
configuration = cell_configuration( tags_configuration, column, :
|
80
|
+
configuration = cell_configuration( tags_configuration, column, :footer, nil )
|
81
81
|
#render_footer_cell( value, column.options_for( identifier ) )
|
82
82
|
render_footer_cell( value, configuration )
|
83
83
|
end
|
data/spec/html_table_spec.rb
CHANGED
@@ -295,6 +295,17 @@ describe 'HTMLTableSpec' do
|
|
295
295
|
end
|
296
296
|
end
|
297
297
|
end
|
298
|
+
footer = table.elements[3]
|
299
|
+
footer.attributes.get_attribute('class').value.must_equal 'my-tfoot-class'
|
300
|
+
row = footer.elements.first
|
301
|
+
row.attributes.get_attribute('class').value.must_equal 'footer-tr'
|
302
|
+
row.elements.each_with_index do |cell, index|
|
303
|
+
if index == 0
|
304
|
+
cell.attributes.get_attribute('class').value.must_equal 'left' # brand column
|
305
|
+
else
|
306
|
+
cell.attributes.get_attribute('class').value.must_equal 'footer-td'
|
307
|
+
end
|
308
|
+
end
|
298
309
|
end
|
299
310
|
|
300
311
|
def document( html )
|
@@ -4,6 +4,7 @@ class CarTableWithConfigBlocks < DiningTable::Table
|
|
4
4
|
presenter.table_config do |config|
|
5
5
|
config.table.class = 'my-table-class'
|
6
6
|
config.thead.class = 'my-thead-class'
|
7
|
+
config.tfoot.class = 'my-tfoot-class'
|
7
8
|
end if presenter.type?(:html)
|
8
9
|
|
9
10
|
presenter.row_config do |config, index, object|
|
@@ -11,7 +12,8 @@ class CarTableWithConfigBlocks < DiningTable::Table
|
|
11
12
|
config.tr.class = 'header-tr'
|
12
13
|
config.th.class = 'header-th'
|
13
14
|
elsif index == :footer
|
14
|
-
config.tr.class = '
|
15
|
+
config.tr.class = 'footer-tr'
|
16
|
+
config.td.class = 'footer-td'
|
15
17
|
else
|
16
18
|
config.tr.class = index.odd? ? 'odd' : 'even'
|
17
19
|
config.tr.class += ' lowstock' if object.stock < 10
|
@@ -21,7 +23,7 @@ class CarTableWithConfigBlocks < DiningTable::Table
|
|
21
23
|
column :brand, :html => { :td => { :class => 'left' } }
|
22
24
|
|
23
25
|
number_of_doors_options = ->( config, index, object ) do
|
24
|
-
config.td.class = 'center'
|
26
|
+
config.td.class = 'center' unless index == :footer
|
25
27
|
config.td.class += ' five_doors' if object && object.number_of_doors == 5
|
26
28
|
end
|
27
29
|
column :number_of_doors, :footer => 'Total', :html => number_of_doors_options
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dining-table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michaël Van Damme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
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: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: juwelier
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -99,7 +99,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
99
99
|
version: '0'
|
100
100
|
requirements: []
|
101
101
|
rubyforge_project:
|
102
|
-
rubygems_version: 2.6
|
102
|
+
rubygems_version: 2.7.6
|
103
103
|
signing_key:
|
104
104
|
specification_version: 4
|
105
105
|
summary: Create tables easily. Supports html, csv and xlsx.
|