If p2p user wants to recreate a child campaign after delted, we just undelete the old child campaign

This commit is contained in:
Eric Schultz 2019-02-05 16:58:01 -06:00
parent 84a48860e2
commit 1adf4d4185
2 changed files with 22 additions and 3 deletions

View file

@ -150,9 +150,15 @@
</div>
</div>
<% else %>
<p>
Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>.
</p>
<% if @child_campaign.deleted %>
<p>
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}\")" %>
</p>
<% else %>
<p>
Seems like you already have a campaign for that cause! <%= link_to "Click here to see it", @child_campaign.url %>.
</p>
<% end %>
<% end %>
</li>

View file

@ -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)