40 lines
629 B
Ruby
40 lines
629 B
Ruby
module ActsAsSorting::Hook
|
|
def acts_as_sorting(*args)
|
|
@options = args.extract_options!
|
|
|
|
|
|
def self.qi_table_order
|
|
@options[:fields]
|
|
|
|
end
|
|
|
|
def self.valid_sort
|
|
r = []
|
|
self.qi_table_order.each do |key, value|
|
|
if value.instance_of? Hash
|
|
if value[:reorder] == false
|
|
|
|
elsif value[:reorder] == true
|
|
if value[:sort_name]
|
|
r << value[:sort_name]
|
|
else
|
|
r << key.to_s
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|
|
return r
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|