about summary refs log tree commit diff stats
path: root/app/helpers
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2019-03-13 15:48:14 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2019-03-13 15:48:14 -0400
commitb62d43ccde70aa6fccf5341e57a695a2cfb289c1 (patch)
tree8e612d68c89e8358c80663f2dcfab35f33ba89c3 /app/helpers
parentb6018ad11156d8b38a87dc682064495cd788608c (diff)
downloadthoughts-b62d43ccde70aa6fccf5341e57a695a2cfb289c1.tar.gz
thoughts-b62d43ccde70aa6fccf5341e57a695a2cfb289c1.tar.bz2
thoughts-b62d43ccde70aa6fccf5341e57a695a2cfb289c1.zip
Game list is sortable
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/application_helper.rb7
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
7end 14end