From 07e0df9203bbeae4b289add2c8b80de20a725637 Mon Sep 17 00:00:00 2001 From: Peter Kozak Date: Mon, 29 Apr 2013 13:40:53 +0200 Subject: sortable helper method added --- app/helpers/application_helper.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'app') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de4d677..9334f7d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,4 +19,9 @@ module ApplicationHelper end end + def sortable(column, title) + link_class = (column.to_s == sort_column.to_s) ? "sort_descending #{sort_descending}" : nil + link_to title, {:sort => column, :desc => !!(!sort_descending && column), :type => @type}, {:class => link_class} + end + end -- cgit v1.2.3