cheveret 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/cheveret.gemspec +1 -1
- data/lib/cheveret.rb +5 -9
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.3
|
data/cheveret.gemspec
CHANGED
data/lib/cheveret.rb
CHANGED
@@ -243,6 +243,7 @@ module Cheveret
|
|
243
243
|
@table.columns.map do |column|
|
244
244
|
attrs = { :class => [type, column.name].join(' '),
|
245
245
|
:style => "width: #{column.width}px;" }
|
246
|
+
attrs[:class] << ' sortable' if column.sortable?
|
246
247
|
|
247
248
|
content_tag(:div, attrs) do
|
248
249
|
yield(column)
|
@@ -258,18 +259,13 @@ module Cheveret
|
|
258
259
|
def sort_tag(column) #:nodoc:
|
259
260
|
return nil unless column.sortable? && @url.present?
|
260
261
|
|
261
|
-
klass = [ 'sortable' ]
|
262
262
|
sort = column.name
|
263
|
-
order = "asc"
|
263
|
+
order = "desc" if params[:sort].to_s == column.name.to_s && params[:order] == "asc"
|
264
|
+
attrs = { :href => url_for(@url.merge({ :sort => sort, :order => order || "desc" })) }
|
264
265
|
|
265
|
-
if params[:sort].to_s == column.name.to_s
|
266
|
-
klass << [ 'sorted', params[:order] ]
|
267
|
-
order = "desc" if params[:order] == "asc"
|
268
|
-
end
|
266
|
+
attrs[:class] = "sorted #{params[:order]}" if params[:sort].to_s == column.name.to_s
|
269
267
|
|
270
|
-
content_tag(:a, column.label,
|
271
|
-
:class => klass.flatten.join(' '),
|
272
|
-
:href => url_for(@url.merge({ :sort => sort, :order => order })) })
|
268
|
+
content_tag(:a, column.label, attrs)
|
273
269
|
end
|
274
270
|
|
275
271
|
def method_missing(method_name, *args, &block) #:nodoc:
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cheveret
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 1.1.
|
9
|
+
- 3
|
10
|
+
version: 1.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Caldwell
|