jam-cloud/admin/app/admin/sale_line_items.rb

46 lines
1.2 KiB
Ruby

ActiveAdmin.register JamRuby::SaleLineItem, :as => 'Sale Line Items' do
menu :label => 'Line Items', :parent => 'Purchases'
config.sort_order = 'created_at DESC'
config.batch_actions = false
config.clear_action_items!
config.filters = true
config.per_page = 50
config.paginate = true
filter :affiliate_referral_id
filter :free
form :partial => 'form'
scope("Non Free", default: true) { |scope| scope.where(free: false).order('created_at desc') }
scope("Free") { |scope| scope.where(free: true).order('created_at desc') }
index do
# default_actions # use this for all view/edit/delete links
column 'Product' do |oo| oo.product end
column "Partner" do |oo|
link_to("#{oo.affiliate_referral.display_name} #{oo.affiliate_referral_fee_in_cents ? "#{oo.affiliate_referral_fee_in_cents}\u00A2" : ''}", oo.affiliate_referral.admin_url, {:title => oo.affiliate_referral.display_name}) if oo.affiliate_referral
end
column 'User' do |oo|
if oo.sale.user
link_to(oo.sale.user.name, admin_user_path(oo.sale.user.id), {:title => oo.sale.user.name})
end
end
column 'Source' do |oo|
oo.sale.source
end
column 'When' do |oo|
oo.created_at
end
end
controller do
end
end