Added possibility to duplicate a campaign
This commit is contained in:
parent
f2ed0e8ce2
commit
2b11a319b4
3 changed files with 30 additions and 0 deletions
|
@ -126,6 +126,19 @@ router.post('/create', passport.parseForm, passport.csrfProtection, (req, res) =
|
|||
});
|
||||
});
|
||||
|
||||
router.post('/duplicate', passport.parseForm, passport.csrfProtection, (req, res) => {
|
||||
campaigns.duplicate(req.body.id, (err, duplicated) => {
|
||||
if (err) {
|
||||
req.flash('danger', err && err.message || err);
|
||||
} else if (duplicated) {
|
||||
req.flash('success', _('Campaign duplicated'));
|
||||
} else {
|
||||
req.flash('info', _('Could not duplicate specified campaign'));
|
||||
}
|
||||
return res.redirect('/campaigns/edit/' + duplicated);
|
||||
});
|
||||
});
|
||||
|
||||
router.get('/edit/:id', passport.csrfProtection, (req, res, next) => {
|
||||
campaigns.get(req.params.id, false, (err, campaign) => {
|
||||
if (err || !campaign) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue