Fix peer-to-peer action
This commit is contained in:
parent
ec3ca228a8
commit
77a59b0037
2 changed files with 13 additions and 7 deletions
|
@ -110,16 +110,22 @@ class CampaignsController < ApplicationController
|
||||||
session[:donor_signup_url] = request.env["REQUEST_URI"]
|
session[:donor_signup_url] = request.env["REQUEST_URI"]
|
||||||
@nonprofit = Nonprofit.find_by_id(params[:npo_id])
|
@nonprofit = Nonprofit.find_by_id(params[:npo_id])
|
||||||
@parent_campaign = Campaign.find_by_id(params[:campaign_id])
|
@parent_campaign = Campaign.find_by_id(params[:campaign_id])
|
||||||
@child_campaign = Campaign.where(
|
|
||||||
profile_id: current_user.profile.id,
|
if params[:campaign_id].present? && !@parent_campaign
|
||||||
parent_campaign_id: @parent_campaign.id
|
raise ActionController::RoutingError.new('Not Found')
|
||||||
).first if @parent_campaign
|
end
|
||||||
@profile = current_user.profile if current_user
|
|
||||||
|
if current_user
|
||||||
|
@profile = current_user.profile
|
||||||
|
@child_campaign = Campaign.where(
|
||||||
|
profile_id: @profile.id,
|
||||||
|
parent_campaign_id: @parent_campaign.id
|
||||||
|
).first
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
# TODO: test if this can be passed by p2p campaign editor
|
|
||||||
def check_nonprofit_status
|
def check_nonprofit_status
|
||||||
if !current_role?(:super_admin) && !current_nonprofit.published
|
if !current_role?(:super_admin) && !current_nonprofit.published
|
||||||
raise ActionController::RoutingError.new('Not Found')
|
raise ActionController::RoutingError.new('Not Found')
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<%= IncludeAsset.js '/client/js/campaigns/peer_to_peer/page.js' %>
|
<%= IncludeAsset.js '/client/js/campaigns/peer_to_peer/page.js' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @parent_campaign.banner_image_url %>
|
<% if @parent_campaign && @parent_campaign.banner_image_url %>
|
||||||
<div class='campaign-banner u-margin'>
|
<div class='campaign-banner u-margin'>
|
||||||
<img src='<%= @parent_campaign.banner_image_url %>'>
|
<img src='<%= @parent_campaign.banner_image_url %>'>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue