table_for_collection 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +11 -9
- data/lib/table_for/column.rb +2 -1
- data/lib/table_for/table.rb +1 -1
- data/lib/table_for/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- data/spec/table_for_collection_spec.rb +19 -0
- metadata +4 -3
data/README.rdoc
CHANGED
@@ -38,26 +38,28 @@ This ruby code will produce following HTML:
|
|
38
38
|
:class => "simple-row"
|
39
39
|
}
|
40
40
|
} do -%>
|
41
|
-
<% column :name %>
|
41
|
+
<% column :name, :html => { :width => "25%" } %>
|
42
42
|
<% column :email %>
|
43
43
|
<% column :address, :title => "Home" %>
|
44
44
|
<% end %>
|
45
45
|
|
46
|
-
You can put :html hash to the options list
|
47
|
-
given html attributes. Also :title value in the :column method
|
48
|
-
title. It will produce HTML similar to:
|
46
|
+
You can put :html hash to the options list (inside the :column method too). In this case
|
47
|
+
table will be created with given html attributes. Also :title value in the :column method
|
48
|
+
will be used as column's title. It will produce HTML similar to:
|
49
49
|
|
50
50
|
<table class="simple-table" id="users" width="100%">
|
51
51
|
<thead>
|
52
52
|
<tr>
|
53
|
-
<
|
54
|
-
<
|
55
|
-
<
|
53
|
+
<th>Name</th>
|
54
|
+
<th>Email</th>
|
55
|
+
<th>Home</th>
|
56
56
|
</tr>
|
57
57
|
</thead>
|
58
58
|
<tbody>
|
59
|
-
<tr class="simple-row"
|
60
|
-
|
59
|
+
<tr class="simple-row">
|
60
|
+
<td width="25%">...</td>
|
61
|
+
<td>...</td>
|
62
|
+
<td>...</td>
|
61
63
|
</tr>
|
62
64
|
</tbody>
|
63
65
|
</table>
|
data/lib/table_for/column.rb
CHANGED
data/lib/table_for/table.rb
CHANGED
data/lib/table_for/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -72,6 +72,25 @@ describe ActionView::Base do
|
|
72
72
|
end
|
73
73
|
end
|
74
74
|
# <%= table_for @users do %>
|
75
|
+
# <% column :name, :html => { :width => "50%" } %>
|
76
|
+
# <% end %>
|
77
|
+
describe "with column :html options" do
|
78
|
+
before(:each) do
|
79
|
+
@html = template.table_for(users) do
|
80
|
+
column :id, :html => { :class => "user-id", :width => "50%" }
|
81
|
+
end
|
82
|
+
end
|
83
|
+
it "should render valid HTML" do
|
84
|
+
@html.should have_selector("table") do |table|
|
85
|
+
table.should have_selector("tbody/tr") do |tr|
|
86
|
+
users.each do |user|
|
87
|
+
tr.should have_selector("td.user-id[@width='50%']")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
# <%= table_for @users do %>
|
75
94
|
# <% columns :name, :email, :address %>
|
76
95
|
# <% end %>
|
77
96
|
describe "with columns" do
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_for_collection
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 0
|
9
|
-
|
9
|
+
- 1
|
10
|
+
version: 1.0.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Dima Lunich
|
@@ -110,7 +111,7 @@ rubyforge_project: ""
|
|
110
111
|
rubygems_version: 1.3.7
|
111
112
|
signing_key:
|
112
113
|
specification_version: 3
|
113
|
-
summary: table_for_collection-1.0
|
114
|
+
summary: table_for_collection-1.0.1
|
114
115
|
test_files:
|
115
116
|
- spec/core_ex/array_spec.rb
|
116
117
|
- spec/spec_helper.rb
|