Migrate recurring_donations#show.json to jbuilder

This commit is contained in:
Eric 2020-05-22 16:00:16 -05:00
parent d81c3e5ec8
commit 085be0c082
2 changed files with 21 additions and 17 deletions

View file

@ -0,0 +1,21 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
json.data recurring_donation do |rd|
json.extract! rd, :id, :total_given,
:supporter_id, :interval,
:time_unit, :designation,
:anonymous, :start_date, :end_date,
:created_at, :paydate, :edit_token
json.donation recurring_donation.donation do |d|
json.extract! d, :id, :amount, :designation
end
json.supporter recurring_donation.supporter do |s|
json.extract! s, :name, :email, :id, :anonymous
end
json.card recurring_donation.card do |c|
json.extract! c, :name
end
end

View file

@ -1,17 +0,0 @@
# frozen_string_literal: true
# License: AGPL-3.0-or-later WITH Web-Template-Output-Additional-Permission-3.0-or-later
object @recurring_donation => :data
attributes :id, :total_given, :supporter_id, :interval, :time_unit, :designation, :anonymous, :start_date, :end_date, :created_at, :paydate, :edit_token
child :donation do
attributes :amount, :designation
end
child :supporter do
attributes :name, :email, :id, :anonymous
end
child :card do
attributes :name
end