table_helpers 0.6 → 0.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +16 -6
  2. data/lib/table_list.rb +13 -13
  3. data/test/table_helpers_test.rb +1 -1
  4. metadata +44 -26
data/README CHANGED
@@ -1,11 +1,12 @@
1
- TableHelpers
2
- ============
1
+ # TableHelpers
3
2
 
4
- Rails 3.0.x table helpers plugin.
3
+ Rails 3.x table helpers plugin.
5
4
 
6
- Examples
7
- =======
5
+ ## Examples
8
6
 
7
+ table_list:
8
+
9
+ ```ruby
9
10
  <%= table_list :class => 'list' do |t| %>
10
11
  <%= t.headers ['First column', 'Second column'] %>
11
12
  <%= t.tr do |tr| %>
@@ -13,9 +14,11 @@ Examples
13
14
  <%= tr.td 'Example 2', :class => 'options' %>
14
15
  <% end %>
15
16
  <% end %>
17
+ ```
16
18
 
17
19
  HTML output:
18
20
 
21
+ ```html
19
22
  <table class="list">
20
23
  <tr>
21
24
  <th>First column</th>
@@ -26,15 +29,21 @@ HTML output:
26
29
  <td class="options">Example 2</td>
27
30
  </tr>
28
31
  </table>
32
+ ```
33
+
34
+ table_data:
29
35
 
36
+ ```ruby
30
37
  <%= table_data :label_size => 150 do |t| %>
31
38
  <%= t.row 'Label name:', 'Data' %>
32
39
  <%= t.section 'Next section:' %>
33
40
  <%= t.row 'Label name 2:', 'Data 2' %>
34
41
  <% end %>
42
+ ```
35
43
 
36
44
  HTML output:
37
45
 
46
+ ```html
38
47
  <table class="info">
39
48
  <tr>
40
49
  <td class="label" width="150">Label name:</td>
@@ -48,5 +57,6 @@ HTML output:
48
57
  <td class="label">Data 2:</td>
49
58
  </tr>
50
59
  </table>
60
+ ```
51
61
 
52
- Copyright (c) 2011 Damian Baćkowski, released under the MIT license
62
+ Copyright (c) 2012 Damian Baćkowski, released under the MIT license
data/lib/table_list.rb CHANGED
@@ -1,31 +1,31 @@
1
- class TableList
1
+ class TableList
2
2
  def initialize(instance)
3
3
  @instance = instance
4
4
  end
5
-
6
- def sortable_headers(columns=[], widths={})
5
+
6
+ def sortable_headers(columns = [], widths = {})
7
7
  @instance.content_tag :tr do
8
- @instance.concat(@instance.get_sortable_table_headers(columns, widths))
8
+ @instance.concat(@instance.get_sortable_table_headers(columns, widths))
9
9
  end
10
10
  end
11
-
12
- def headers(columns=[], widths={})
11
+
12
+ def headers(columns = [], widths = {})
13
13
  @instance.content_tag :tr do
14
14
  @instance.concat(@instance.get_table_headers(columns, widths))
15
15
  end
16
16
  end
17
-
18
- def td(data, options={})
19
- @instance.content_tag :td, data.to_s.html_safe, :class => options[:class]# unless options[:class].blank?
17
+
18
+ def td(data, html_options = {})
19
+ @instance.content_tag :td, data.to_s.html_safe, html_options
20
20
  end
21
21
 
22
- def tr(&block)
22
+ def tr(html_options = {}, &block)
23
23
  raise "need a block" unless block_given?
24
24
 
25
25
  result = @instance.capture do
26
- @instance.content_tag :tr do
27
- block.call(self)
26
+ @instance.content_tag :tr, html_options do
27
+ block.call(self)
28
28
  end
29
- end
29
+ end
30
30
  end
31
31
  end
@@ -16,7 +16,7 @@ class TableHelpersTest < ActionView::TestCase
16
16
  tr.td('Example 1') +
17
17
  tr.td('Example 2', :class => 'options')
18
18
  end +
19
- t.tr do |tr|
19
+ t.tr do |tr|
20
20
  tr.td('Example 3') +
21
21
  tr.td('Example 4', :class => 'options')
22
22
  end
metadata CHANGED
@@ -1,54 +1,72 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: table_helpers
3
- version: !ruby/object:Gem::Version
4
- version: '0.6'
3
+ version: !ruby/object:Gem::Version
4
+ hash: 5
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 7
9
+ version: "0.7"
6
10
  platform: ruby
7
- authors:
8
- - Damian Baćkowski
11
+ authors:
12
+ - "Damian Ba\xC4\x87kowski"
9
13
  autorequire:
10
14
  bindir: bin
11
15
  cert_chain: []
12
- date: 2012-02-18 00:00:00.000000000 Z
16
+
17
+ date: 2012-12-21 00:00:00 Z
13
18
  dependencies: []
14
- description: The table_helpers library provides a simple helpers to create table lists
15
- with headers and presenting data in tables.
19
+
20
+ description: The table_helpers library provides a simple helpers to create table lists with headers and presenting data in tables.
16
21
  email: damianbackowski@gmail.com
17
22
  executables: []
23
+
18
24
  extensions: []
25
+
19
26
  extra_rdoc_files: []
20
- files:
27
+
28
+ files:
21
29
  - Rakefile
22
- - lib/tasks/table_helpers.rake
23
- - lib/table_list.rb
24
30
  - lib/table_data.rb
31
+ - lib/tasks/table_helpers.rake
25
32
  - lib/table_helpers.rb
33
+ - lib/table_list.rb
26
34
  - rails/init.rb
27
- - test/test_helper.rb
28
35
  - test/table_helpers_test.rb
36
+ - test/test_helper.rb
29
37
  - README
30
- homepage: https://github.com/paki-paki/table_helpers
38
+ homepage: https://github.com/dbackowski/table_helpers
31
39
  licenses: []
40
+
32
41
  post_install_message:
33
42
  rdoc_options: []
34
- require_paths:
43
+
44
+ require_paths:
35
45
  - lib
36
- required_ruby_version: !ruby/object:Gem::Requirement
46
+ required_ruby_version: !ruby/object:Gem::Requirement
37
47
  none: false
38
- requirements:
39
- - - ! '>='
40
- - !ruby/object:Gem::Version
41
- version: '0'
42
- required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ hash: 3
52
+ segments:
53
+ - 0
54
+ version: "0"
55
+ required_rubygems_version: !ruby/object:Gem::Requirement
43
56
  none: false
44
- requirements:
45
- - - ! '>='
46
- - !ruby/object:Gem::Version
47
- version: '0'
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ hash: 3
61
+ segments:
62
+ - 0
63
+ version: "0"
48
64
  requirements: []
65
+
49
66
  rubyforge_project:
50
- rubygems_version: 1.8.15
67
+ rubygems_version: 1.8.10
51
68
  signing_key:
52
69
  specification_version: 3
53
- summary: Table helpers for Rails 3.0.x
70
+ summary: Table helpers for Rails 3.2.x
54
71
  test_files: []
72
+