diff options
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de4d677..2c420c4 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -19,4 +19,22 @@ module ApplicationHelper end end + def sortable(column, title) + if !defined?(sort_descending) + return title + end + + if column.to_s == sort_column.to_s + link_class = "sort_descending #{sort_descending}" + desc = !!(!sort_descending && column) + icon = sort_descending ? ' <i class = "icon-chevron-up"></i> ' : ' <i class = "icon-chevron-down"></i> ' + else + link_class = nil + desc = nil + icon = '' + end + + link_to raw('') + title + raw(icon), {:sort => column, :desc => desc, :type => @type}, {:class => link_class} + end + end |