-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
197 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# frozen_string_literal: true | ||
|
||
json.id campaign_charity.id | ||
json.charity do | ||
json.id campaign_charity.charity.id | ||
end | ||
json.givingSgUrl campaign_charity.giving_sg_url |
6 changes: 6 additions & 0 deletions
6
backend/app/views/campaign_charities/_campaign_charity.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaign_charities/base', campaign_charity: campaign_charity | ||
json.charity do | ||
json.partial! 'charities/list', charity: campaign_charity.charity | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaign_charities/campaign_charity', campaign_charity: campaign_charity | ||
json.partial! 'secondary_donations/breakdown', donation_breakdown: campaign_charity.donation_breakdown |
6 changes: 6 additions & 0 deletions
6
backend/app/views/campaign_charities/_donation_public.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaign_charities/campaign_charity', campaign_charity: campaign_charity | ||
json.partial! 'secondary_donations/breakdown', donation_breakdown: campaign_charity.donation_breakdown | ||
|
||
json.attributes!.delete('givingSgUrl') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
json.id campaign.id | ||
json.name campaign.name | ||
json.description campaign.description | ||
json.promisedAmount campaign.promised_amount | ||
json.start campaign.start | ||
json.end campaign.end | ||
json.imageBase64 encoded_file_data_url(campaign.image) | ||
|
||
json.charities campaign.campaign_charities do |campaign_charity| | ||
json.partial! 'campaign_charities/base', campaign_charity: campaign_charity | ||
end | ||
|
||
json.primaryDonor do | ||
json.partial! 'primary_donors/primary_donor', primary_donor: campaign.primary_donor | ||
end | ||
|
||
json.interestId campaign.interest_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# frozen_string_literal: true | ||
|
||
json.array! @campaigns do |campaign| | ||
json.id campaign.id | ||
json.name campaign.name | ||
json.promisedAmount campaign.promised_amount | ||
json.start campaign.start | ||
json.end campaign.end | ||
json.primaryDonor do | ||
json.id campaign.primary_donor.id | ||
json.name campaign.primary_donor.name | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaigns/base', campaign: @campaign | ||
|
||
json.donations do | ||
json.partial! 'secondary_donations/breakdown', donation_breakdown: @campaign.donation_breakdown | ||
end | ||
|
||
json.charities [] # ignore the charities from the base partial, since Jbuilder merges instead of overwriting | ||
json.charities do | ||
json.array! @campaign.campaign_charities, partial: 'campaign_charities/donation', as: :campaign_charity | ||
end | ||
|
||
json.coupons do | ||
json.array! @campaign.coupons, partial: 'coupons/list', as: :coupon | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
json.array! @campaigns, partial: 'campaigns/campaign', as: :campaign | ||
json.array! @campaigns do |campaign| | ||
json.id campaign.id | ||
json.name campaign.name | ||
json.description campaign.description | ||
json.imageBase64 encoded_file_data_url(campaign.image) | ||
|
||
json.charities do | ||
json.array! campaign.charities, partial: 'charities/list', as: :charity | ||
end | ||
|
||
json.donations do | ||
json.partial! 'secondary_donations/breakdown', donation_breakdown: campaign.donation_breakdown | ||
end | ||
|
||
json.couponsRedeemedCount campaign.num_redeemed_coupons | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaigns/base', campaign: @campaign |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'campaigns/campaign', campaign: @campaign | ||
json.partial! 'campaigns/base', campaign: @campaign | ||
|
||
json.donations do | ||
json.partial! 'secondary_donations/breakdown', donation_breakdown: @campaign.donation_breakdown | ||
end | ||
|
||
json.charities [] # ignore the charities from the base partial, since Jbuilder merges instead of overwriting | ||
json.charities do | ||
json.array! @campaign.campaign_charities, partial: 'campaign_charities/donation_public', as: :campaign_charity | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'charities/minimal', charity: charity | ||
json.logoBase64 encoded_file_data_url(charity.logo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# frozen_string_literal: true | ||
|
||
json.id charity.id | ||
json.name charity.name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
json.id coupon.id | ||
json.urlToken coupon.url_token | ||
json.denomination coupon.denomination | ||
json.campaignId coupon.campaign_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
json.partial! 'coupons/base', coupon: coupon | ||
|
||
if coupon.secondary_donation.present? | ||
json.secondaryDonation do | ||
json.partial! 'secondary_donations/secondary_donation', secondary_donation: coupon.secondary_donation | ||
end | ||
|
||
json.charity do | ||
json.partial! 'charities/minimal', charity: coupon.secondary_donation.campaign_charity.charity | ||
end | ||
else | ||
json.secondaryDonation nil | ||
json.charity nil | ||
end |
11 changes: 11 additions & 0 deletions
11
backend/app/views/secondary_donations/_breakdown.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# frozen_string_literal: true | ||
|
||
json.primaryDonor do | ||
json.amount donation_breakdown[:primary_donor_amount] | ||
json.fraction donation_breakdown[:primary_donor_fraction] | ||
end | ||
|
||
json.secondaryDonors do | ||
json.amount donation_breakdown[:secondary_donors_amount] | ||
json.fraction donation_breakdown[:secondary_donors_fraction] | ||
end |
14 changes: 2 additions & 12 deletions
14
backend/app/views/secondary_donations/_secondary_donation.json.jbuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,6 @@ | ||
# frozen_string_literal: true | ||
|
||
json.id secondary_donation.id | ||
json.couponId secondary_donation.coupon_id | ||
json.amount secondary_donation.amount | ||
|
||
if secondary_donation.coupon | ||
json.coupon do | ||
json.partial! 'coupons/coupon', coupon: secondary_donation.coupon | ||
end | ||
else | ||
json.coupon nil | ||
end | ||
|
||
json.charity do | ||
json.partial! 'charities/charity', charity: secondary_donation.campaign_charity.charity | ||
end | ||
json.campaignCharityId secondary_donation.campaign_charity_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters