greentable 0.9.5 → 0.9.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 +5 -5
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/howto_publish_gem.md +9 -0
- data/lib/greentable/greentable_table.rb +9 -1
- data/lib/greentable/version.rb +1 -1
- data/test/dummy/.rakeTasks +2 -2
- data/test/greentable_table_test.rb +11 -0
- metadata +6 -36
- data/test/dummy/log/development.log +0 -3308
- data/test/dummy/log/test.log +0 -6539
- data/test/dummy/tmp/cache/assets/C4C/3E0/sprockets%2F316d5a21a3694448e136215cf552c829 +0 -0
- data/test/dummy/tmp/cache/assets/C81/FF0/sprockets%2F839f902c241150aec5ba59751228875d +0 -0
- data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/test/dummy/tmp/cache/assets/DAA/B50/sprockets%2F7e7e12081cd77f6e2a99a61ee35b8cce +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/dummy/tmp/cache/assets/E21/3E0/sprockets%2Ff9530da0d9bbb15351aef3eb378bddbc +0 -0
- data/test/test.iml +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 6e1d10cfc55b4fefbda7e1d7e3593c16dad30d8e7190972362bb1c6415e1efe8
|
4
|
+
data.tar.gz: a6b36e7604dc3e1f9176d940284fa0d4c410f3fcd8158cf2518349388e0c819e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc7f583aef517aea41260198dd019a82ccf9149492efaccce6d78bd5fcec47401f5897eddfb556cd11a577fcd0e7be61d3cf7bed721a228d76f028b6b8ff4307
|
7
|
+
data.tar.gz: c9ee4ac13c0a9aef7d356e433615a397d65998362a1396d6ad142507424bfdfa1125bbc0b7b8a6229634e8b453ef75856ec289fa8c16a652e188516049ebcfa7
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -371,6 +371,8 @@ Add a couple of http query parameters in your view and your done:
|
|
371
371
|
<% end %>
|
372
372
|
```
|
373
373
|
|
374
|
+
Green Export and Green Printing requires *Nokogiri* to be installed. Add 'nokogiri' as a gem dependency to your project if you want to use greentable's export or printing feature
|
375
|
+
|
374
376
|
### Available Query Parameters
|
375
377
|
|
376
378
|
* **greentable_id**=*any string* [REQUIRED]. A unique html tag id to tell the rack middleware which greentable to extract.
|
@@ -75,7 +75,7 @@ module Greentable
|
|
75
75
|
end
|
76
76
|
|
77
77
|
def to_s
|
78
|
-
ret =
|
78
|
+
ret = String.new
|
79
79
|
return ret if @td_html.empty?
|
80
80
|
ret << "<table#{do_attributes(nil,@opts)}>"
|
81
81
|
to_s_thead_content(ret)
|
@@ -119,6 +119,13 @@ module Greentable
|
|
119
119
|
|
120
120
|
def do_attributes(i, o)
|
121
121
|
row = i.nil? ? nil : @records[i]
|
122
|
+
o = if o.is_a?(Proc) && row
|
123
|
+
row.instance_eval(&o)
|
124
|
+
elsif o.is_a?(Proc) && row.nil?
|
125
|
+
nil
|
126
|
+
else
|
127
|
+
o
|
128
|
+
end
|
122
129
|
return "" if o.nil? || o.empty?
|
123
130
|
ret = o.map{|k,v| "#{k.is_a?(Proc) ? row.instance_eval(&k).to_s : k.to_s}=\"#{v.is_a?(Proc) ? row.instance_eval(&v).to_s : v.to_s}\""}.join(" ").strip
|
124
131
|
ret = " " + ret unless ret.empty?
|
@@ -131,6 +138,7 @@ module Greentable
|
|
131
138
|
|
132
139
|
def deep_merge!(source_hash, specialized_hash)
|
133
140
|
#this code is originally from the gem hash-deep-merge, but has been modified slightly
|
141
|
+
return specialized_hash unless specialized_hash.is_a?(Hash)
|
134
142
|
specialized_hash.each_pair do |rkey, rval|
|
135
143
|
if source_hash.has_key?(rkey) then
|
136
144
|
lval = source_hash[rkey]
|
data/lib/greentable/version.rb
CHANGED
data/test/dummy/.rakeTasks
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
2
|
<Settings><!--This file was automatically generated by Ruby plugin.
|
3
3
|
You are allowed to:
|
4
4
|
1. Remove rake task
|
5
5
|
2. Add existing rake tasks
|
6
6
|
To add existing rake tasks automatically delete this file and reload the project.
|
7
|
-
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
@@ -214,4 +214,15 @@ class GreentableTableTest < ActiveSupport::TestCase
|
|
214
214
|
end
|
215
215
|
end
|
216
216
|
end
|
217
|
+
|
218
|
+
test "tr proc" do
|
219
|
+
gt = Greentable::Table.new(self, [0], {tr: Proc.new{{foo: 'bar'}}})
|
220
|
+
gt.process do |gt, x|
|
221
|
+
gt.col('col') do
|
222
|
+
x
|
223
|
+
end
|
224
|
+
end
|
225
|
+
assert_equal "<table><thead><tr><th>col</th></tr></thead><tbody><tr foo=\"bar\"><td>0</td></tr></tbody></table>", gt.to_s
|
226
|
+
|
227
|
+
end
|
217
228
|
end
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: greentable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wael Chatila
|
8
|
-
autorequire:
|
9
8
|
bindir: bin
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: rails
|
@@ -138,7 +137,6 @@ dependencies:
|
|
138
137
|
version: '0'
|
139
138
|
description: Greentable automatically produces HTML tables from an array in a succinct
|
140
139
|
way. It also provides an easy way to export and print a particular table
|
141
|
-
email:
|
142
140
|
executables: []
|
143
141
|
extensions: []
|
144
142
|
extra_rdoc_files: []
|
@@ -153,6 +151,7 @@ files:
|
|
153
151
|
- README.md
|
154
152
|
- Rakefile
|
155
153
|
- greentable.gemspec
|
154
|
+
- howto_publish_gem.md
|
156
155
|
- lib/greentable.rb
|
157
156
|
- lib/greentable/configuration.rb
|
158
157
|
- lib/greentable/export.rb
|
@@ -192,33 +191,19 @@ files:
|
|
192
191
|
- test/dummy/db/test.sqlite3
|
193
192
|
- test/dummy/lib/assets/.gitkeep
|
194
193
|
- test/dummy/log/.gitkeep
|
195
|
-
- test/dummy/log/development.log
|
196
|
-
- test/dummy/log/test.log
|
197
194
|
- test/dummy/public/404.html
|
198
195
|
- test/dummy/public/422.html
|
199
196
|
- test/dummy/public/500.html
|
200
197
|
- test/dummy/public/favicon.ico
|
201
198
|
- test/dummy/script/rails
|
202
|
-
- test/dummy/tmp/cache/assets/C4C/3E0/sprockets%2F316d5a21a3694448e136215cf552c829
|
203
|
-
- test/dummy/tmp/cache/assets/C81/FF0/sprockets%2F839f902c241150aec5ba59751228875d
|
204
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
205
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
206
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
207
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
208
|
-
- test/dummy/tmp/cache/assets/DAA/B50/sprockets%2F7e7e12081cd77f6e2a99a61ee35b8cce
|
209
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
210
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
211
|
-
- test/dummy/tmp/cache/assets/E21/3E0/sprockets%2Ff9530da0d9bbb15351aef3eb378bddbc
|
212
199
|
- test/export_test.rb
|
213
200
|
- test/greentable_table_test.rb
|
214
|
-
- test/test.iml
|
215
201
|
- test/test_helper.rb
|
216
202
|
- todo.txt
|
217
203
|
homepage: https://github.com/waelchatila/greentable
|
218
204
|
licenses:
|
219
205
|
- LGPLv3+
|
220
206
|
metadata: {}
|
221
|
-
post_install_message:
|
222
207
|
rdoc_options: []
|
223
208
|
require_paths:
|
224
209
|
- lib
|
@@ -233,18 +218,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
218
|
- !ruby/object:Gem::Version
|
234
219
|
version: '0'
|
235
220
|
requirements: []
|
236
|
-
|
237
|
-
rubygems_version: 2.2.2
|
238
|
-
signing_key:
|
221
|
+
rubygems_version: 3.7.1
|
239
222
|
specification_version: 4
|
240
223
|
summary: Rails declarative html tables with export and print features
|
241
224
|
test_files:
|
225
|
+
- test/dummy/Rakefile
|
242
226
|
- test/dummy/app/assets/javascripts/application.js
|
243
227
|
- test/dummy/app/assets/stylesheets/application.css
|
244
228
|
- test/dummy/app/controllers/application_controller.rb
|
245
229
|
- test/dummy/app/helpers/application_helper.rb
|
246
230
|
- test/dummy/app/views/application/home.html.erb
|
247
231
|
- test/dummy/app/views/layouts/application.html.erb
|
232
|
+
- test/dummy/config.ru
|
248
233
|
- test/dummy/config/application.rb
|
249
234
|
- test/dummy/config/boot.rb
|
250
235
|
- test/dummy/config/database.yml
|
@@ -260,28 +245,13 @@ test_files:
|
|
260
245
|
- test/dummy/config/initializers/wrap_parameters.rb
|
261
246
|
- test/dummy/config/locales/en.yml
|
262
247
|
- test/dummy/config/routes.rb
|
263
|
-
- test/dummy/config.ru
|
264
248
|
- test/dummy/db/development.sqlite3
|
265
249
|
- test/dummy/db/test.sqlite3
|
266
|
-
- test/dummy/log/development.log
|
267
|
-
- test/dummy/log/test.log
|
268
250
|
- test/dummy/public/404.html
|
269
251
|
- test/dummy/public/422.html
|
270
252
|
- test/dummy/public/500.html
|
271
253
|
- test/dummy/public/favicon.ico
|
272
|
-
- test/dummy/Rakefile
|
273
254
|
- test/dummy/script/rails
|
274
|
-
- test/dummy/tmp/cache/assets/C4C/3E0/sprockets%2F316d5a21a3694448e136215cf552c829
|
275
|
-
- test/dummy/tmp/cache/assets/C81/FF0/sprockets%2F839f902c241150aec5ba59751228875d
|
276
|
-
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
277
|
-
- test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705
|
278
|
-
- test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655
|
279
|
-
- test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6
|
280
|
-
- test/dummy/tmp/cache/assets/DAA/B50/sprockets%2F7e7e12081cd77f6e2a99a61ee35b8cce
|
281
|
-
- test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994
|
282
|
-
- test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af
|
283
|
-
- test/dummy/tmp/cache/assets/E21/3E0/sprockets%2Ff9530da0d9bbb15351aef3eb378bddbc
|
284
255
|
- test/export_test.rb
|
285
256
|
- test/greentable_table_test.rb
|
286
|
-
- test/test.iml
|
287
257
|
- test/test_helper.rb
|