Add in create_from_template call

This commit is contained in:
Eric Schultz 2018-11-07 11:43:23 -06:00
parent 758cbf1134
commit e378434b30
2 changed files with 5 additions and 3 deletions

View file

@ -54,7 +54,7 @@
</p>
<a class="button">Create campaign from template</a>
<!--= on 'click' (create_campaign '<%= raw(template.create_campaign_params.to_json) %>') -->
<!--= on 'click' (create_campaign_from_template '<%= raw(template.create_campaign_params.to_json) %>') -->
<a class="button red">Delete template</a>
<!--= on 'click' (delete_template <%= template.id %>) -->

View file

@ -74,10 +74,10 @@ appl.def('delete_template', function(id) {
})
appl.def('create_campaign', function(campaign_params) {
appl.def('create_campaign_from_template', function(campaign_params) {
appl.def('loading', true)
var url = '/nonprofits/' + app.nonprofit_id + '/campaigns'
var url = '/nonprofits/' + app.nonprofit_id + '/campaigns/create_from_template'
var params = new Object
params.campaign = JSON.parse(campaign_params)
params.campaign.profile_id = app.profile_id
@ -103,3 +103,5 @@ appl.def('create_campaign', function(campaign_params) {
appl.notify(req.responseText)
})
})