Created
April 14, 2013 12:08
-
-
Save mortik/5382477 to your computer and use it in GitHub Desktop.
Sortable Helper for tables in Rails Dependencies:
- url_plumber gem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf-8 | |
module SortableHelper | |
def sortable column, title = nil, remote = true | |
title ||= column.titleize | |
css_class = column == sort_column ? "current #{sort_direction}" : nil | |
direction = column == sort_column && sort_direction == "asc" ? "desc" : "asc" | |
link_to title, plumb(sort: column, direction: direction, page: nil), {:class => css_class} | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment