blocks 0.6 → 0.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.
@@ -4,14 +4,12 @@ module Blocks
|
|
4
4
|
options = {}
|
5
5
|
options[:view] = self
|
6
6
|
|
7
|
-
@blocks ||= Blocks::
|
7
|
+
@blocks ||= Blocks::Builder.new(options)
|
8
8
|
end
|
9
9
|
|
10
|
-
def evaluated_content_options(options={})
|
11
|
-
puts "Checking evaluated_content_options #{options.inspect}"
|
12
|
-
|
10
|
+
def evaluated_content_options(options={}, parameters={})
|
13
11
|
evaluated_options = {}
|
14
|
-
options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(
|
12
|
+
options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(parameters) : v)}
|
15
13
|
evaluated_options
|
16
14
|
end
|
17
15
|
|
@@ -19,7 +17,7 @@ module Blocks
|
|
19
17
|
options[:view] = self
|
20
18
|
options[:records] = records
|
21
19
|
options[:block] = block
|
22
|
-
options[:row_html] = {:class => lambda { cycle('odd', 'even')}} if options[:row_html].nil?
|
20
|
+
options[:row_html] = {:class => lambda { |parameters| cycle('odd', 'even')}} if options[:row_html].nil?
|
23
21
|
|
24
22
|
Blocks::TableFor.new(options).render
|
25
23
|
end
|
@@ -49,7 +49,7 @@
|
|
49
49
|
<% end %>
|
50
50
|
|
51
51
|
<%= table.define :row do |options| %>
|
52
|
-
<%= content_tag :tr, evaluated_content_options(options[:row_html]
|
52
|
+
<%= content_tag :tr, evaluated_content_options(options[:row_html], options) do %>
|
53
53
|
<%= table.use :data_columns, options %>
|
54
54
|
<% end %>
|
55
55
|
<% end %>
|
data/lib/blocks.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module Blocks
|
2
|
-
class
|
2
|
+
class Builder
|
3
3
|
|
4
4
|
attr_accessor :view, :blocks, :block_positions, :anonymous_block_number,
|
5
5
|
:start_rendering_blocks, :block_groups, :shared_options
|
@@ -148,7 +148,7 @@ module Blocks
|
|
148
148
|
begin
|
149
149
|
view.concat(view.render "#{shared_options[:templates_folder]}/#{name.to_s}", shared_options.merge(render_options))
|
150
150
|
rescue
|
151
|
-
|
151
|
+
puts "Could not render template #{name} in directory #{shared_options[:templates_folder]}"
|
152
152
|
end
|
153
153
|
end
|
154
154
|
|
data/lib/blocks/list_for.rb
CHANGED
data/lib/blocks/table_for.rb
CHANGED
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blocks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 7
|
9
|
+
version: "0.7"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Hunter
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-12-
|
18
|
+
date: 2010-12-10 00:00:00 -05:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -29,8 +29,8 @@ extra_rdoc_files:
|
|
29
29
|
- LICENSE
|
30
30
|
- README
|
31
31
|
files:
|
32
|
+
- lib/blocks/builder.rb
|
32
33
|
- lib/blocks/container.rb
|
33
|
-
- lib/blocks/context.rb
|
34
34
|
- lib/blocks/engine.rb
|
35
35
|
- lib/blocks/list_for.rb
|
36
36
|
- lib/blocks/table_for.rb
|