diff --git a/app/views/campaigns/peer_to_peer.html.erb b/app/views/campaigns/peer_to_peer.html.erb index 856964fe..6645d644 100644 --- a/app/views/campaigns/peer_to_peer.html.erb +++ b/app/views/campaigns/peer_to_peer.html.erb @@ -150,9 +150,15 @@ <% else %> -

- Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>. -

+ <% if @child_campaign.deleted %> +

+ Seems like you already have a campaign for that cause! <%= link_to "Click here to reactivate your campaign", "javascript:appl.undelete_p2p(\"/nonprofits/#{@child_campaign.nonprofit_id}/campaigns/#{@child_campaign.id}\")" %> +

+ <% else %> +

+ Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>. +

+ <% end %> <% end %> diff --git a/client/js/campaigns/peer_to_peer/page.js b/client/js/campaigns/peer_to_peer/page.js index 5eb8c01c..c9730bcf 100644 --- a/client/js/campaigns/peer_to_peer/page.js +++ b/client/js/campaigns/peer_to_peer/page.js @@ -5,6 +5,19 @@ require('../../common/image_uploader') var request = require("../../common/client") +appl.def('undelete_p2p', function (url){ + appl.def('loading', true) + request.put(url + '/soft_delete', {delete: false}).end(function(err, resp) { + if (err) { + appl.def('loading', false) + } + else{ + window.location = url + } + + }) +}) + // setting up some default values appl.def('is_signing_up', true) .def('selected_result_index', -1)