table-for 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -9,8 +9,8 @@ begin
9
9
  require 'jeweler'
10
10
  Jeweler::Tasks.new do |gemspec|
11
11
  gemspec.name = "table-for"
12
- gemspec.summary = ""
13
- gemspec.description = ""
12
+ gemspec.summary = "table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated"
13
+ gemspec.description = "table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated"
14
14
  gemspec.email = "hunterae@gmail.com"
15
15
  gemspec.homepage = "http://github.com/hunterae/table-for"
16
16
  gemspec.authors = ["Andrew Hunter"]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.12
1
+ 0.0.13
@@ -1,13 +1,20 @@
1
- <%= table.define :thead do %>
2
- <thead>
1
+ <%= table.define :table do |options| %>
2
+ <%= content_tag :table, options[:table_html] do %>
3
+ <%= table.use :thead %>
4
+ <%= table.use :tbody %>
5
+ <% end %>
6
+ <% end %>
7
+
8
+ <%= table.define :thead do |options| %>
9
+ <%= content_tag :thead, options[:thead_html] do %>
3
10
  <%= table.use :header_row %>
4
- </thead>
11
+ <% end %>
5
12
  <% end %>
6
13
 
7
- <%= table.define :header_row do %>
8
- <tr>
14
+ <%= table.define :header_row do |options| %>
15
+ <%= content_tag :tr, options[:header_row_html] do %>
9
16
  <%= table.use :header_columns %>
10
- </tr>
17
+ <% end %>
11
18
  <% end %>
12
19
 
13
20
  <%= table.define :header_columns do |options| %>
@@ -53,10 +60,10 @@
53
60
  <%= link_to label, "#{url}?#{parameters.to_query}" %>
54
61
  <% end %>
55
62
 
56
- <%= table.define :tbody do %>
57
- <tbody>
63
+ <%= table.define :tbody do |options| %>
64
+ <%= content_tag :tbody, options[:tbody_html] do %>
58
65
  <%= table.use :rows %>
59
- </tbody>
66
+ <% end %>
60
67
  <% end %>
61
68
 
62
69
  <%= table.define :rows do %>
@@ -79,16 +86,16 @@
79
86
  <% end %>
80
87
  <% end %>
81
88
 
82
- <%= table.define :edit, :action => :edit do |record, options| %>
83
- <%= link_to "Edit", [options[:action], options[:scope], record].flatten, options[:link_html] %>
89
+ <%= table.define :edit, :action => :edit, :link_label => "Edit" do |record, options| %>
90
+ <%= link_to options[:link_label], [options[:action], options[:scope], record].flatten, options[:link_html] %>
84
91
  <% end %>
85
92
 
86
- <%= table.define :show, :action => nil do |record, options| %>
87
- <%= link_to "Show", [options[:action], options[:scope], record].flatten, options[:link_html] %>
93
+ <%= table.define :show, :action => nil, :link_label => "Show" do |record, options| %>
94
+ <%= link_to options[:link_label], [options[:action], options[:scope], record].flatten, options[:link_html] %>
88
95
  <% end %>
89
96
 
90
- <%= table.define :delete, :link_html => {} do |record, options| %>
91
- <%= link_to "Delete", [options[:scope], record].flatten, {:method => "delete", :confirm => "Are you sure you want to delete this #{record.class.to_s.humanize}?"}.merge(options[:link_html]) %>
97
+ <%= table.define :delete, :link_html => {}, :link_label => "Delete" do |record, options| %>
98
+ <%= link_to options[:link_label], [options[:scope], record].flatten, {:method => "delete", :confirm => "Are you sure you want to delete this #{record.class.to_s.humanize}?"}.merge(options[:link_html]) %>
92
99
  <% end %>
93
100
 
94
101
  <% table.columns.each do |column| %>
@@ -97,9 +104,4 @@
97
104
  <% end %>
98
105
  <% end %>
99
106
 
100
- <%= table.use :table do |options| %>
101
- <%= content_tag :table, options[:table_html] do %>
102
- <%= table.use :thead %>
103
- <%= table.use :tbody %>
104
- <% end %>
105
- <% end %>
107
+ <%= table.use :table %>
@@ -1,12 +1,7 @@
1
1
  require "rails"
2
- # require "table-for"
3
2
 
4
3
  module TableFor
5
4
  class Engine < Rails::Engine
6
- # initializer "table_for.initialize_helpers" do
7
- # ActiveSupport.on_load(:action_view) do
8
- # include TableFor::HelperMethods
9
- # end
10
- # end
5
+
11
6
  end
12
7
  end
@@ -7,16 +7,14 @@ module TableFor
7
7
  end
8
8
 
9
9
  def table_for(records, options={}, &block)
10
- options[:view] = self
11
10
  options[:records] = records
12
- options[:block] = block
13
11
  options[:row_html] = {:class => lambda { |parameters| cycle('odd', 'even')}} if options[:row_html].nil?
14
12
  options[:template] = "table_for/table_for"
15
13
  options[:templates_folder] = "table_for"
16
14
  options[:record_variable] = "records"
17
15
  options[:variable] = "table"
18
16
 
19
- TableFor::Base.new(options).render
17
+ TableFor::Base.new(self, options, &block).render
20
18
  end
21
19
  end
22
20
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: table-for
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
4
+ hash: 5
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 12
10
- version: 0.0.12
9
+ - 13
10
+ version: 0.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andrew Hunter
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-03 00:00:00 -04:00
18
+ date: 2011-05-16 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -62,7 +62,7 @@ dependencies:
62
62
  - 0
63
63
  version: "0"
64
64
  requirement: *id003
65
- description: ""
65
+ description: table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated
66
66
  email: hunterae@gmail.com
67
67
  executables: []
68
68
 
@@ -113,6 +113,6 @@ rubyforge_project:
113
113
  rubygems_version: 1.3.7
114
114
  signing_key:
115
115
  specification_version: 3
116
- summary: ""
116
+ summary: table-for is a table builder for an array of objects, easily allowing overriding of how any aspect of the table is generated
117
117
  test_files: []
118
118