Module: SortableColumns::ActionViewExtensions::SortHelper
- Defined in:
- lib/sortable_columns/action_view_extensions/sort_helper.rb
Instance Method Summary collapse
Instance Method Details
#sortable(column, options = {}) ⇒ Object
5 6 7 8 9 10 11 |
# File 'lib/sortable_columns/action_view_extensions/sort_helper.rb', line 5 def sortable(column, ={}) title = [:title] || column.titleize remote = [:remote] || false css_class = column == params[:column] ? "current #{ params[:direction] }" : nil direction = column == params[:column] && params[:direction] == "asc" ? "desc" : "asc" link_to title, params.merge(column: column, direction: direction, page: nil), { remote: remote, class: css_class } end |