Module: SortOrderHelper

Included in:
PatientsHelper, TestPlansHelper, XdsPatientsHelper, XdsUtilityHelper
Defined in:
lib/sort_order.rb

Instance Method Summary collapse

Instance Method Details



89
90
91
92
# File 'lib/sort_order.rb', line 89

def link_to_sort(field_spec, label)
  sort_field = controller.sort_spec == field_spec ? "-#{field_spec}" : field_spec
  (:div, link_to(label, "?sort=#{sort_field}"), :class => 'sortable')
end

#sort_order_class(field_spec) ⇒ Object



81
82
83
84
85
86
87
# File 'lib/sort_order.rb', line 81

def sort_order_class(field_spec)
  if [ field_spec, "-#{field_spec}" ].include? controller.sort_spec
    controller.sort_spec.chars.first == '-' ? "selected sorted-descending" : "selected sorted-ascending"
  else
    "sortable"
  end
end