sorted 0.3.6 → 0.3.7

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.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Sorted is a simple object that will take an sql order string and a url sort string to let you sort large datasets over many pages (using {will_paginate}[http://github.com/mislav/will_paginate]) without loosing state.
4
4
 
5
- Using Rails master it will create a `sorted` scope and a two view helpers
5
+ Using Rails master it will create a sorted scope and a two view helpers
6
6
 
7
7
  == Example
8
8
 
@@ -10,7 +10,7 @@ Using Rails master it will create a `sorted` scope and a two view helpers
10
10
 
11
11
  gem sorted
12
12
 
13
- === The view:
13
+ === View
14
14
 
15
15
  link_to_sorted "Email", :email
16
16
 
@@ -22,7 +22,7 @@ or on the next page load when you then sort by something else....
22
22
 
23
23
  http://myapp/users?sort=name_asc!email_asc
24
24
 
25
- === The model:
25
+ === Model
26
26
 
27
27
  This will initially sort by email ascending:
28
28
 
@@ -36,7 +36,6 @@ You might want to roll your own link_to_sorted method to use jQuery ui css class
36
36
 
37
37
  def link_to_sorted(name, order)
38
38
  sorter = sorted(order)
39
- name = name.nil? ? "" : name.to_s
40
39
  css_class = case sorter.to_css
41
40
  when "sorted asc"
42
41
  "ui-icon ui-icon-triangle-1-n"
@@ -45,7 +44,7 @@ You might want to roll your own link_to_sorted method to use jQuery ui css class
45
44
  when "sorted"
46
45
  "ui-icon ui-icon-carat-2-n-s"
47
46
  end
48
- link_to(content_tag(:span, nil, {:class => css_class}) + name, sorter.params)
47
+ link_to(content_tag(:span, nil, {:class => css_class}) + name.to_s, sorter.params)
49
48
  end
50
49
 
51
50
  Tables are best displayed with alternating shades for each row, so put this in your helper:
@@ -1,3 +1,3 @@
1
1
  module Example
2
- VERSION = "0.3.6"
2
+ VERSION = "0.3.7"
3
3
  end
@@ -10,9 +10,8 @@ module Sorted
10
10
 
11
11
  def link_to_sorted(name, order, options = {})
12
12
  sorter = sorted(order)
13
- name = name.nil? ? "" : name.to_s
14
- options[:class] = options[:class].nil? ? sorter.to_css : "#{options[:class]} #{sorter.to_css}"
15
- link_to(name, sorter.params, options)
13
+ options[:class] = [options[:class], sorter.to_css].join(' ').strip
14
+ link_to(name.to_s, sorter.params, options)
16
15
  end
17
16
  end
18
17
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 6
9
- version: 0.3.6
8
+ - 7
9
+ version: 0.3.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Rufus Post