greentable 0.9.5 → 0.9.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/greentable/greentable_table.rb +8 -0
- data/lib/greentable/version.rb +1 -1
- data/test/greentable_table_test.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dfd49c2ae156aa0a4335574aba4a6315ede741ec
|
4
|
+
data.tar.gz: b35fd583be07e1eb3700495b8475e5a57b96cf75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10971a531679fadbbcbe7d5139e998a5163cb8e371b197ebc81961a719141d9c27047801d4f464f6ea77a3796f03bacbcf886e4100f81b78624b721b455d4f5b
|
7
|
+
data.tar.gz: 076534cbb4412afeb2e3614c4c46fc2d0b62e119fdfa6c645c5e2fa51ca077a0386d4bdc52f187a93598791644939399b36821f8a662c61960a4379a35b6efaf
|
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.
|
@@ -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
@@ -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,14 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Wael Chatila
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|