File tree 1 file changed +7
-8
lines changed
1 file changed +7
-8
lines changed Original file line number Diff line number Diff line change 1
1
ActiveAdmin . register Transfer do
2
+ includes :post , movements : { account : [ :accountable , :organization ] }
3
+
4
+ actions :index , :destroy
5
+
2
6
action_item :upload_csv , only : :index do
3
7
link_to I18n . t ( "active_admin.users.upload_from_csv" ) , action : "upload_csv"
4
8
end
18
22
id_column
19
23
column :post
20
24
column :reason
21
- column :source do |transfer |
22
- acc = transfer . movements . find_by ( 'amount < 0' ) . account . accountable
23
- acc . class . name == "Member" ? acc . user : acc
24
- end
25
- column :destination do |transfer |
26
- acc = transfer . movements . find_by ( 'amount > 0' ) . account . accountable
27
- acc . class . name == "Member" ? acc . user : acc
25
+ column "From - To" do |transfer |
26
+ accounts_from_movements ( transfer , with_links : true ) . join ( " #{ glyph ( :arrow_right ) } " ) . html_safe
28
27
end
29
28
column :amount do |transfer |
30
- transfer . movements . find_by ( 'amount > 0' ) . amount
29
+ seconds_to_hm ( transfer . movements . first . amount . abs )
31
30
end
32
31
column :created_at do |transfer |
33
32
l transfer . created_at . to_date , format : :long
You can’t perform that action at this time.
0 commit comments