sortablecolumns 3.0.3 → 3.0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/History.txt +3 -0
- data/README.txt +4 -3
- data/lib/sortablecolumns/sortablecolumns.rb +1 -1
- data/lib/sortablecolumns/version.rb +1 -1
- data/sortablecolumns.gemspec +1 -1
- data/test/sortablecolumns_test.rb +5 -11
- metadata +6 -5
data/.gitignore
CHANGED
data/History.txt
CHANGED
data/README.txt
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
= SortableColumns
|
2
2
|
|
3
|
-
*
|
3
|
+
* https://github.com/bdondo/sortablecolumns
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
7
|
SortableColumns is a Rails plugin that allows easy creation of sortable HTML tables as plain HTML or as a YUI DataTable (requires YUI4Rails plugin - http://rubyforge.org/projects/yui4rails/). Table column characteristics (e.g., default sort direction, data type, CSS attributes, and methods to wrap the output in) are defined in YAML files (more options to be added later, such auto-detecting the column types, using a hash, etc.). Multiple table column definitions can be created for a single model.
|
8
8
|
|
9
|
-
Download an example app here: http://www.bryandonovan.com/sortable_columns_example.tar.gz
|
10
9
|
|
11
10
|
Also see: ActiveRecord::Acts::SortableColumns::ClassMethods#sortable_columns
|
12
11
|
|
@@ -179,8 +178,10 @@ You can also have extra parameters in the url that are attributes in the results
|
|
179
178
|
==== View:
|
180
179
|
|
181
180
|
<%= print_table(@people, :mysorter %>
|
181
|
+
|
182
182
|
Or if you want alternating styles for table rows:
|
183
183
|
<%= print_table(@people, :mysorter, :tr => {:classes => ['even','odd']}) %>
|
184
|
+
|
184
185
|
And you can specify a table CSS class & id:
|
185
186
|
<%= print_table(@people, :mysorter, :table => {:class => 'yui-skin-sam', :id => 'yui_table'}) %>
|
186
187
|
|
@@ -200,7 +201,7 @@ This is beta-quality software. It works well according to my tests, but the API
|
|
200
201
|
|
201
202
|
(The MIT License)
|
202
203
|
|
203
|
-
Copyright (c) 2008 Bryan Donovan
|
204
|
+
Copyright (c) 2008-2011 Bryan Donovan
|
204
205
|
|
205
206
|
Permission is hereby granted, free of charge, to any person obtaining
|
206
207
|
a copy of this software and associated documentation files (the
|
@@ -55,7 +55,7 @@ module ActiveRecord #:nodoc:
|
|
55
55
|
if self.#{sorter_name}_in_resultset?(col)
|
56
56
|
ret = obj.send(col)
|
57
57
|
if ret == '' or ret.nil?
|
58
|
-
ret = " " #so empty TD cells still get displayed
|
58
|
+
ret = " ".html_safe #so empty TD cells still get displayed
|
59
59
|
end
|
60
60
|
return ret
|
61
61
|
end
|
data/sortablecolumns.gemspec
CHANGED
@@ -8,7 +8,7 @@ Gem::Specification.new do |s|
|
|
8
8
|
s.platform = Gem::Platform::RUBY
|
9
9
|
s.authors = ["Bryan Donovan"]
|
10
10
|
s.email = ["b.dondo+rubyforge@gmail.com"]
|
11
|
-
s.homepage = "
|
11
|
+
s.homepage = "https://github.com/bdondo/sortablecolumns"
|
12
12
|
s.summary = "Sortable HTML tables for Rails"
|
13
13
|
s.description = "Sortable HTML tables for Rails"
|
14
14
|
|
@@ -94,20 +94,9 @@ end
|
|
94
94
|
# Routes
|
95
95
|
#---------------------------------------------------
|
96
96
|
MySorterApp::Application.routes.draw do
|
97
|
-
# match 'products/:id' => 'catalog#view'
|
98
97
|
match 'people/show/:id' => 'people#show', :as => :person
|
99
98
|
match 'people/:person_id/foods' => 'foods#show', :as => :people_foods
|
100
|
-
#match 'foods/meats/:id' => 'foods#show', :as => :meat
|
101
|
-
|
102
|
-
#map.people_foods '/people/:person_id/foods',
|
103
|
-
#:controller => 'foods',
|
104
|
-
#:action => 'show'
|
105
|
-
#simulate the RESTful urls:
|
106
99
|
resources :dudes
|
107
|
-
#map.dude '/dudes/:id',
|
108
|
-
#:controller => 'dudes',
|
109
|
-
#:action => 'show'
|
110
|
-
|
111
100
|
match ':controller(/:action(/:id(.:format)))'
|
112
101
|
end
|
113
102
|
|
@@ -465,6 +454,11 @@ class SortablecolumnsHelperTest < Test::Unit::TestCase
|
|
465
454
|
assert_equal "<td class=\"left\"><a href=\"/people/show/#{@person.id}\">Billy</a></td>", @view.print_col(@person, :mysorter, :firstname)
|
466
455
|
end
|
467
456
|
|
457
|
+
def test_print_col_with_empty_string
|
458
|
+
@person.stubs(:firstname).returns('')
|
459
|
+
assert_equal "<td class=\"left\"><a href=\"/people/show/#{@person.id}\"> </a></td>", @view.print_col(@person, :mysorter, :firstname)
|
460
|
+
end
|
461
|
+
|
468
462
|
def test_print_col_dude_dudename
|
469
463
|
assert_equal "<td><a href=\"http://test.host/dudes/#{@dude.id}\">The Dude</a></td>", @view.print_col(@dude, :dude_report, :dudename)
|
470
464
|
end
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sortablecolumns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 113
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 3
|
8
8
|
- 0
|
9
9
|
- 3
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 3.0.3.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Bryan Donovan
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-
|
19
|
+
date: 2011-05-14 00:00:00 -07:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -93,7 +94,7 @@ files:
|
|
93
94
|
- test/col_def_test_yaml_files/person/tacosorter.yml
|
94
95
|
- test/sortablecolumns_test.rb
|
95
96
|
has_rdoc: true
|
96
|
-
homepage:
|
97
|
+
homepage: https://github.com/bdondo/sortablecolumns
|
97
98
|
licenses: []
|
98
99
|
|
99
100
|
post_install_message:
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
123
|
requirements: []
|
123
124
|
|
124
125
|
rubyforge_project: sortablecolumns
|
125
|
-
rubygems_version: 1.
|
126
|
+
rubygems_version: 1.6.0
|
126
127
|
signing_key:
|
127
128
|
specification_version: 3
|
128
129
|
summary: Sortable HTML tables for Rails
|