2019-09-13 22:56:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module DiscoursePatrons
|
|
|
|
class AdminController < ::Admin::AdminController
|
|
|
|
def index
|
2019-09-15 07:00:39 -04:00
|
|
|
payments = Payment.all.order(payments_order)
|
2019-09-13 22:56:28 -04:00
|
|
|
|
|
|
|
render_serialized(payments, PaymentSerializer)
|
|
|
|
end
|
2019-09-15 07:00:39 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def payments_order
|
|
|
|
if %w(created_at amount).include?(params[:order])
|
|
|
|
params[:order].to_sym
|
|
|
|
else
|
|
|
|
:created_at
|
|
|
|
end
|
|
|
|
end
|
2019-09-13 22:56:28 -04:00
|
|
|
end
|
|
|
|
end
|