blocks 0.1 → 0.2

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.
Files changed (2) hide show
  1. data/app/helpers/blocks/helper.rb +31 -0
  2. metadata +4 -3
@@ -0,0 +1,31 @@
1
+ module Blocks
2
+ module Helper
3
+
4
+ # def self.included(base)
5
+ # base.extend Helper
6
+ # # base.helper_method :table_for, :evaluated_content_options, :request_blocks
7
+ # end
8
+
9
+ def table_for(records, options={}, &block)
10
+ options[:view] = self
11
+ options[:records] = records
12
+ options[:block] = block
13
+ options[:row_html] = {:class => lambda { cycle('odd', 'even')}} if options[:row_html].nil?
14
+
15
+ Blocks::TableFor.new(options).render
16
+ end
17
+
18
+ def evaluated_content_options(options={})
19
+ evaluated_options = {}
20
+ options.each_pair { |k, v| evaluated_options[k] = (v.is_a?(Proc) ? v.call : v)}
21
+ evaluated_options
22
+ end
23
+
24
+ def request_blocks
25
+ options = {}
26
+ options[:view] = self
27
+
28
+ @request_blocks ||= Blocks::Context.new(options)
29
+ end
30
+ end
31
+ end
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: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 1
9
- version: "0.1"
8
+ - 2
9
+ version: "0.2"
10
10
  platform: ruby
11
11
  authors:
12
12
  - Andrew Hunter
@@ -33,6 +33,7 @@ files:
33
33
  - lib/blocks/engine.rb
34
34
  - lib/blocks/table_for.rb
35
35
  - lib/blocks.rb
36
+ - app/helpers/blocks/helper.rb
36
37
  - app/views/blocks/tables/_table.html.erb
37
38
  - README
38
39
  - LICENSE