display_for 0.1.9 → 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/display_for.gemspec +1 -1
- data/lib/display_for/builder/list.rb +10 -1
- data/lib/display_for/builder/table.rb +1 -1
- data/spec/lib/builder/list_spec.rb +8 -1
- data/spec/lib/builder/table_spec.rb +2 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.10
|
data/display_for.gemspec
CHANGED
@@ -25,16 +25,25 @@ module DisplayFor
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def to_s
|
28
|
-
result =
|
28
|
+
result = "\n".html_safe
|
29
29
|
|
30
30
|
@collection.each do |resource|
|
31
31
|
result << build_row(resource)
|
32
32
|
end
|
33
33
|
|
34
|
+
if @footer
|
35
|
+
result << @footer.build_row(nil)
|
36
|
+
end
|
37
|
+
|
34
38
|
html_options[:class] ||= "list #{@resource_class.to_s.underscore}-list"
|
35
39
|
content_tag(:ul, result, html_options).html_safe
|
36
40
|
end
|
37
41
|
|
42
|
+
def footer
|
43
|
+
@footer = List.new(resource_class, [], html_options, template)
|
44
|
+
yield @footer
|
45
|
+
end
|
46
|
+
|
38
47
|
end
|
39
48
|
end
|
40
49
|
end
|
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
LIST_OUTPUT = %q|<ul class="list test_model-list"
|
3
|
+
LIST_OUTPUT = %q|<ul class="list test_model-list">
|
4
|
+
<li id="test_model_1"><span>1</span><span>foo</span><span>bar</span></li>
|
5
|
+
<li><span> </span></li>
|
4
6
|
</ul>|
|
5
7
|
|
6
8
|
module DisplayFor
|
@@ -12,6 +14,11 @@ module DisplayFor
|
|
12
14
|
t.attribute :id
|
13
15
|
t.attribute :first_name
|
14
16
|
t.attribute :last_name
|
17
|
+
t.footer do |f|
|
18
|
+
f.html :form do
|
19
|
+
' '.html_safe
|
20
|
+
end
|
21
|
+
end
|
15
22
|
end
|
16
23
|
end
|
17
24
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
TABLE_OUTPUT = %q|<table class="table table-bordered table-striped test_model-table"><thead><tr><th class="col_id">id</th><th class="col_first_name">first_name</th><th class="col_last_name">last_name</th></tr></thead>
|
4
|
-
<tbody
|
4
|
+
<tbody>
|
5
|
+
<tr id="test_model_1"><td>1</td><td>foo</td><td>bar</td></tr>
|
5
6
|
</tbody><tfoot><tr><td colspan="3"> </td></tr>
|
6
7
|
</tfoot></table>|
|
7
8
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: display_for
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
159
|
version: '0'
|
160
160
|
segments:
|
161
161
|
- 0
|
162
|
-
hash:
|
162
|
+
hash: 4109272304261322082
|
163
163
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
164
|
none: false
|
165
165
|
requirements:
|