If a campaign is done, P2P campaign link is for the nonprofit, not the campaign

This commit is contained in:
Eric Schultz 2018-11-21 17:23:25 -06:00
parent d7017db267
commit 0ad9181533
2 changed files with 4 additions and 1 deletions

View file

@ -164,6 +164,9 @@ class Campaign < ActiveRecord::Base
(self.end_datetime.to_date - Date.today).to_i (self.end_datetime.to_date - Date.today).to_i
end end
def finished?
self.end_datetime && self.end_datetime < Time.now
end
def child_params def child_params
excluded_for_peer_to_peer = %w( excluded_for_peer_to_peer = %w(

View file

@ -87,7 +87,7 @@
<% if !@campaign.child_campaign? %> <% if !@campaign.child_campaign? %>
<aside class='u-marginBottom--15 pastelBox--grey'> <aside class='u-marginBottom--15 pastelBox--grey'>
<a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='/peer-to-peer?campaign_id=<%= @peer_to_peer_campaign_param %>'> <a class='button u-width--full' target='_blank' if-branded='background-color, dark' href='<%= @campaign.finished? ? "/peer-to-peer?npo_id=#{@nonprofit.id}" : "/peer-to-peer?campaign_id=#{ @peer_to_peer_campaign_param}" %>'>
Start Your Own Campaign for <%= @nonprofit.name %> Start Your Own Campaign for <%= @nonprofit.name %>
</a> </a>
</aside> </aside>