Add a confirm dialog when deleting templates

This commit is contained in:
Kasia Jarmołkowicz 2018-05-18 17:59:17 +02:00 committed by Eric Schultz
parent bb0bebe8f7
commit 2db5e72bcb
2 changed files with 21 additions and 17 deletions

View file

@ -1,6 +1,7 @@
require('../../common/pikaday-timepicker')
require('../../components/wizard')
require('../../common/image_uploader')
var confirmation = require('../../common/confirmation')
var format_err = require('../../common/format_response_error')
appl.def('advance_campaign_template_name_step', function(form_obj) {
@ -50,6 +51,8 @@ function post_campaign_template(form_data) {
}
appl.def('delete_template', function(id) {
var result = confirmation('Are you sure?')
result.confirmed = function() {
appl.def('loading', true)
var url = '/nonprofits/' + app.nonprofit_id + '/campaign_templates/' + id
@ -67,4 +70,5 @@ appl.def('delete_template', function(id) {
appl.notify('Successfully deleted template.')
appl.redirect('/nonprofits/' + app.nonprofit_id + '/campaign_templates')
})
}
})