Sha256: 1110591be712fa385d9db36cf35d91cfe9a0fa65d6b17ecca4d9d1a20b31e93d
Contents?: true
Size: 993 Bytes
Versions: 2
Compression:
Stored size: 993 Bytes
Contents
require_dependency "customer_vault/application_controller" require 'handles_sortable_columns' module CustomerVault class PeopleController < ApplicationController handles_sortable_columns def index authorize! :list, Person sorted_people = sortable_column_order do |column, direction| case column when 'name' (direction == :asc) ? get_index_people.sort_by(&:name) : get_index_people.sort_by(&:name).reverse when 'zip' (direction == :asc) ? get_index_people.sort_by{ |p| p.address.zip } : get_index_people.sort_by{ |p| p.address.zip }.reverse else get_index_people.sort_by(&:name) end end @people = Kaminari.paginate_array(sorted_people).page(params[:page]).per(8) end private def get_index_people Individual.search(params[:q]) + Corporation.search(params[:q]) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
customer_vault-1.2.2 | app/controllers/customer_vault/people_controller.rb |
customer_vault-1.2.1 | app/controllers/customer_vault/people_controller.rb |