diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/application_helper.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index a8b1c7e..8008b04 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb | |||
@@ -4,4 +4,11 @@ module ApplicationHelper | |||
4 | content_for :title, text | 4 | content_for :title, text |
5 | end | 5 | end |
6 | 6 | ||
7 | def sortable(col, title = nil) | ||
8 | title ||= col.titleize | ||
9 | css_class = (col == sort_column) ? "current #{sort_direction}" : nil | ||
10 | direction = (col == sort_column and sort_direction == "asc") ? "desc" : "asc" | ||
11 | link_to title, {:sort => col, :dir => direction}, {:class => css_class} | ||
12 | end | ||
13 | |||
7 | end | 14 | end |