table_helpers 0.7 → 0.8
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.
- data/{README → README.md} +0 -0
- data/Rakefile +1 -9
- data/lib/table_helpers.rb +15 -11
- metadata +5 -5
data/{README → README.md}
RENAMED
File without changes
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rake/testtask'
|
3
|
-
require 'rake/
|
3
|
+
require 'rake/task'
|
4
4
|
|
5
5
|
desc 'Default: run unit tests.'
|
6
6
|
task :default => :test
|
@@ -13,11 +13,3 @@ Rake::TestTask.new(:test) do |t|
|
|
13
13
|
t.verbose = true
|
14
14
|
end
|
15
15
|
|
16
|
-
desc 'Generate documentation for the table_helpers plugin.'
|
17
|
-
Rake::RDocTask.new(:rdoc) do |rdoc|
|
18
|
-
rdoc.rdoc_dir = 'rdoc'
|
19
|
-
rdoc.title = 'TableHelpers'
|
20
|
-
rdoc.options << '--line-numbers' << '--inline-source'
|
21
|
-
rdoc.rdoc_files.include('README')
|
22
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
23
|
-
end
|
data/lib/table_helpers.rb
CHANGED
@@ -29,18 +29,22 @@ module TableHelpers
|
|
29
29
|
column_name = columns[j][0]
|
30
30
|
sort_columns = columns[j][1..columns[j].length-1]
|
31
31
|
|
32
|
-
if
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
if column_name.present?
|
33
|
+
if params[:order_by] == sort_columns.join(', ')
|
34
|
+
link = link_to(column_name, p.merge('order_by' => "#{sort_columns.join(' DESC, ') + ' DESC'}"), :class=> "sortdown")
|
35
|
+
elsif params[:order_by] == sort_columns.join(' DESC, ') + ' DESC'
|
36
|
+
link = link_to(column_name, p.merge('order_by' => sort_columns.join(', ')), :class=> "sortup")
|
37
|
+
else
|
38
|
+
link = link_to(column_name, p.merge('order_by' => sort_columns.join(', ')), :class=> "sort-none")
|
39
|
+
end
|
40
|
+
|
41
|
+
if widths.has_key?(i)
|
42
|
+
headers.push("<th width=\"%s\">%s</th>" % [widths[i],link])
|
43
|
+
else
|
44
|
+
headers.push("<th>%s</th>" % [link])
|
45
|
+
end
|
36
46
|
else
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
if widths.has_key?(i)
|
41
|
-
headers.push("<th width=\"%s\">%s</th>" % [widths[i],link])
|
42
|
-
else
|
43
|
-
headers.push("<th>%s</th>" % [link])
|
47
|
+
headers.push('<th></th>')
|
44
48
|
end
|
45
49
|
|
46
50
|
i += 1
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: table_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 8
|
9
|
+
version: "0.8"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- "Damian Ba\xC4\x87kowski"
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2013-05-31 00:00:00 Z
|
18
18
|
dependencies: []
|
19
19
|
|
20
20
|
description: The table_helpers library provides a simple helpers to create table lists with headers and presenting data in tables.
|
@@ -34,7 +34,7 @@ files:
|
|
34
34
|
- rails/init.rb
|
35
35
|
- test/table_helpers_test.rb
|
36
36
|
- test/test_helper.rb
|
37
|
-
- README
|
37
|
+
- README.md
|
38
38
|
homepage: https://github.com/dbackowski/table_helpers
|
39
39
|
licenses: []
|
40
40
|
|