simple_table 0.0.12 → 0.0.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/simple_table/cell.rb +6 -3
- data/lib/simple_table/row.rb +1 -3
- data/lib/simple_table/rows.rb +2 -2
- data/lib/simple_table/table.rb +3 -5
- data/lib/simple_table/tag.rb +2 -1
- data/lib/simple_table/version.rb +1 -1
- metadata +6 -6
data/lib/simple_table/cell.rb
CHANGED
@@ -2,12 +2,15 @@ module SimpleTable
|
|
2
2
|
class Cell < Tag
|
3
3
|
self.level = 3
|
4
4
|
|
5
|
-
attr_reader :content
|
6
|
-
|
7
5
|
def initialize(parent, content = nil, options = {})
|
8
6
|
super(parent, options)
|
9
7
|
@content = content
|
10
8
|
options[:colspan] = table.columns.size if options[:colspan] == :all
|
9
|
+
yield self if block_given?
|
10
|
+
end
|
11
|
+
|
12
|
+
def content
|
13
|
+
table.view && @content.is_a?(Symbol) ? table.view.t(@content) : @content
|
11
14
|
end
|
12
15
|
|
13
16
|
def render
|
@@ -18,4 +21,4 @@ module SimpleTable
|
|
18
21
|
parent.head? ? :th : :td
|
19
22
|
end
|
20
23
|
end
|
21
|
-
end
|
24
|
+
end
|
data/lib/simple_table/row.rb
CHANGED
@@ -6,11 +6,9 @@ module SimpleTable
|
|
6
6
|
attr_reader :cells
|
7
7
|
|
8
8
|
def initialize(parent, record = nil, options = {}, &block)
|
9
|
-
super(parent, options)
|
10
|
-
|
11
9
|
@parent = parent
|
10
|
+
@options = options
|
12
11
|
@cells = []
|
13
|
-
@block = block
|
14
12
|
|
15
13
|
yield(*[self, record].compact) if block_given?
|
16
14
|
end
|
data/lib/simple_table/rows.rb
CHANGED
data/lib/simple_table/table.rb
CHANGED
@@ -12,15 +12,13 @@ module SimpleTable
|
|
12
12
|
@collection_name = options.delete(:collection_name).to_s if options.key?(:collection_name)
|
13
13
|
|
14
14
|
super(nil, options.reverse_merge(:id => collection_name, :class => "#{collection_name} list"))
|
15
|
-
|
16
|
-
yield(self) if block_given?
|
17
15
|
end
|
18
16
|
|
19
17
|
['head', 'body', 'foot'].each do |name|
|
20
18
|
class_eval <<-code
|
21
|
-
def #{name} # def head
|
22
|
-
@#{name} ||= #{name.classify}.new(self) # @head ||= Head.new(self)
|
23
|
-
end
|
19
|
+
def #{name}(*args, &block) # def head(*args, &block)
|
20
|
+
@#{name} ||= #{name.classify}.new(self, *args, &block) # @head ||= Head.new(self, *args, &block)
|
21
|
+
end # end
|
24
22
|
code
|
25
23
|
end
|
26
24
|
|
data/lib/simple_table/tag.rb
CHANGED
data/lib/simple_table/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_table
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 5
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 13
|
10
|
+
version: 0.0.13
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sven Fuchs
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date:
|
19
|
+
date: 2011-01-11 00:00:00 +01:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -115,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
requirements: []
|
116
116
|
|
117
117
|
rubyforge_project: "[none]"
|
118
|
-
rubygems_version: 1.
|
118
|
+
rubygems_version: 1.4.2
|
119
119
|
signing_key:
|
120
120
|
specification_version: 3
|
121
121
|
summary: "[summary]"
|