blocks 0.5 → 0.6

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.
@@ -1,5 +1,5 @@
1
1
  module Blocks
2
- module Helper
2
+ module HelperMethods
3
3
  def blocks
4
4
  options = {}
5
5
  options[:view] = self
@@ -8,8 +8,10 @@ module Blocks
8
8
  end
9
9
 
10
10
  def evaluated_content_options(options={})
11
+ puts "Checking evaluated_content_options #{options.inspect}"
12
+
11
13
  evaluated_options = {}
12
- options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call : v)}
14
+ options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call(options) : v)}
13
15
  evaluated_options
14
16
  end
15
17
 
@@ -1,13 +1,3 @@
1
- <%= list.define :list_items do %>
2
- <% if records %>
3
- <% records.each do |record| %>
4
- <%= list.use :item, :record => record %>
5
- <% end %>
6
- <% else %>
7
- <%= list.use :items %>
8
- <% end %>
9
- <% end %>
10
-
11
1
  <%= list.define :item do |options| %>
12
2
  <%= content_tag :li, options[:item_html] do %>
13
3
  <%= options[:field] ? options[:record].send(:field) : options[:record].to_s %>
@@ -15,9 +5,17 @@
15
5
  <% end %>
16
6
 
17
7
  <%= list.define :items do |options| %>
18
- <% list.items.each do |item| %>
19
- <%= content_tag :li, options.merge(item.options)[:item_html] do %>
20
- <%= list.use item.name %>
8
+ <% if records %>
9
+ <% records.each do |record| %>
10
+ <%= content_tag :li, options[:item_html] do %>
11
+ <%= list.use :item, :record => record %>
12
+ <% end %>
13
+ <% end %>
14
+ <% else %>
15
+ <% list.items.each do |item| %>
16
+ <%= content_tag :li, options.merge(item.options)[:item_html] do %>
17
+ <%= list.use item.name %>
18
+ <% end %>
21
19
  <% end %>
22
20
  <% end %>
23
21
  <% end %>
@@ -30,6 +28,6 @@
30
28
 
31
29
  <%= list.use :list do |options| %>
32
30
  <%= content_tag :ul, options[:list_html] do %>
33
- <%= list.use :list_items %>
31
+ <%= list.use :items %>
34
32
  <% end %>
35
33
  <% 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]) do %>
52
+ <%= content_tag :tr, evaluated_content_options(options[:row_html].merge({:record => options[:record]})) do %>
53
53
  <%= table.use :data_columns, options %>
54
54
  <% end %>
55
55
  <% end %>
@@ -3,9 +3,9 @@ require "rails"
3
3
 
4
4
  module Blocks
5
5
  class Engine < Rails::Engine
6
- initializer "blocks.initialize" do
6
+ initializer "blocks.initialize_helpers" do
7
7
  ActiveSupport.on_load(:action_view) do
8
- include Blocks::Helper
8
+ include Blocks::HelperMethods
9
9
  end
10
10
  end
11
11
  end
@@ -3,10 +3,6 @@ module Blocks
3
3
  alias items block_positions
4
4
  alias item use
5
5
 
6
- def header(name, options={}, &block)
7
- define("#{name.to_s}_header", options, &block)
8
- end
9
-
10
6
  def initialize(options)
11
7
  options[:template] = "blocks/list"
12
8
  options[:templates_folder] = "blocks/lists"
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: 1
4
+ hash: 7
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 5
9
- version: "0.5"
8
+ - 6
9
+ version: "0.6"
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-07 00:00:00 -05:00
18
+ date: 2010-12-08 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -35,7 +35,7 @@ files:
35
35
  - lib/blocks/list_for.rb
36
36
  - lib/blocks/table_for.rb
37
37
  - lib/blocks.rb
38
- - app/helpers/blocks/helper.rb
38
+ - app/helpers/blocks/helper_methods.rb
39
39
  - app/views/blocks/_list.html.erb
40
40
  - app/views/blocks/_table.html.erb
41
41
  - README