sortablecolumns 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,6 @@
1
+ === 0.1.6 / 2009-02-20
2
+ * Fixed bugs so tests actually pass in Rails 2.2.2. Erroneously tested against 2.1.2 for release 0.1.5.
3
+
1
4
  === 0.1.5 / 2009-02-19
2
5
  * Fixed bug 23868 - now works with Rails 2.2 - http://rubyforge.org/tracker/?atid=23868&group_id=6158&func=browse
3
6
  * Added default_sorter as an option instead of creating a yaml file. Also able to generate default yaml output using
@@ -20,7 +20,7 @@ module Sortablecolumns
20
20
 
21
21
  if datatype == 'number'
22
22
  precision = klass.send("#{sorter}_precision",col)
23
- txt = number_with_precision(txt, precision) if precision
23
+ txt = number_with_precision(txt, :precision => precision) if precision
24
24
  end
25
25
 
26
26
  if datatype == 'currency'
@@ -45,7 +45,9 @@ module Sortablecolumns
45
45
  link_ops = klass.send("#{sorter}_link_options",col).dup
46
46
  raise "link_options must be defined for #{klass}:#{col}" unless link_ops
47
47
  if link_ops[:object_url]
48
- txt = link_to(txt, send("#{klass.to_s.downcase}_url", obj))
48
+ #link_to failed in the tests in Rails 2.2.2
49
+ url = send("#{klass.to_s.downcase}_url", obj)
50
+ txt = "<a href=\"#{url}\">#{txt}</a>"
49
51
  elsif link_ops[:controller] && link_ops[:action]
50
52
  if link_ops[:id] && link_ops[:id] == 'obj_id'
51
53
  link_ops[:id] = obj.id
@@ -70,7 +72,7 @@ module Sortablecolumns
70
72
  unless url.match(/http/)
71
73
  url = 'http://' + default_url_options[:host] + url
72
74
  end
73
- txt = link_to(txt, url)
75
+ txt = "<a href=\"#{url}\">#{txt}</a>"
74
76
  end
75
77
  end
76
78
 
@@ -131,7 +133,8 @@ module Sortablecolumns
131
133
  sortable = klass.send("#{sorter}_sortable?", col)
132
134
  return content_tag("th", th_txt, :class => th_class) unless sortable
133
135
  url = get_col_heading_url(klass, sorter, col)
134
- link = link_to(th_txt, url)
136
+ #link = link_to(th_txt, url)
137
+ link = "<a href=\"#{url}\">#{th_txt}</a>"
135
138
  return content_tag("th", link, :class => th_class)
136
139
  end
137
140
 
@@ -1,5 +1,5 @@
1
1
  module Sortablecolumns #:nodoc:
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
4
4
  Dir[File.join(File.dirname(__FILE__), "sortablecolumns/**/*.rb")].sort.each { |lib| require lib }
5
5
  ActiveRecord::Base.send(:include, ActiveRecord::Acts::Sortablecolumns)
@@ -20,7 +20,8 @@
20
20
  sortable: false
21
21
  print_options:
22
22
  wrappers:
23
- - truncate: 5
23
+ - truncate:
24
+ :length: 5
24
25
  - simple_format
25
26
  -
26
27
  print_view:
@@ -172,7 +172,7 @@ class SortableColumnsTest< Test::Unit::TestCase
172
172
  "print_text"=>"Print"},
173
173
  "lastname"=>{"heading"=>"Last", "datatype"=>"string"},
174
174
  "description"=>
175
- {"print_options"=>{"wrappers"=>[{"truncate"=>5}, "simple_format"]},
175
+ {"print_options"=>{"wrappers"=>[{"truncate"=>{:length => 5}}, "simple_format"]},
176
176
  "sortable"=>false,
177
177
  "heading"=>"Description",
178
178
  "datatype"=>"string"},
@@ -235,7 +235,7 @@ class SortableColumnsTest< Test::Unit::TestCase
235
235
  assert_equal({"wrappers"=> ['auto_link','sanitize', 'simple_format']}, Person.mysorter_print_options('description'))
236
236
  assert_equal({"wrappers"=> 'sanitize'}, Person.mysorter_print_options('lastname'))
237
237
  assert_equal nil, Person.mysorter_print_options('age')
238
- assert_equal({"wrappers"=> [{'truncate' => 5},'simple_format']}, Dude.dude_report_print_options('description'))
238
+ assert_equal({"wrappers"=> [{'truncate' => {:length => 5}},'simple_format']}, Dude.dude_report_print_options('description'))
239
239
  end
240
240
 
241
241
  def test_td_class
@@ -354,12 +354,14 @@ end
354
354
  class SortablecolumnsHelperTest < Test::Unit::TestCase
355
355
 
356
356
  class View
357
+ include ActionView::Helpers
357
358
  include ActionView::Helpers::TextHelper
358
359
  include ActionView::Helpers::NumberHelper
359
360
  include ActionView::Helpers::SanitizeHelper
360
361
  include ActionView::Helpers::TagHelper
361
362
  include ActionView::Helpers::UrlHelper
362
363
  include ActionController::UrlWriter
364
+
363
365
  include Sortablecolumns::Helpers
364
366
  default_url_options[:host] = 'test.host'
365
367
  attr_accessor :params
@@ -422,7 +424,7 @@ class SortablecolumnsHelperTest < Test::Unit::TestCase
422
424
  end
423
425
 
424
426
  def test_print_col_dude_description
425
- #should be same as: simple_format(truncate(@dude.description, 5))
427
+ #should be same as: simple_format(truncate(@dude.description, :length => 5))
426
428
  expected = "<p>Th...</p>"
427
429
  assert_equal "<td>#{expected}</td>", @view.print_col(@dude, :dude_report, :description)
428
430
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sortablecolumns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Donovan - http://www.bryandonovan.com
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-02-19 00:00:00 -08:00
12
+ date: 2009-02-20 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency