Merge branch 'master' into master
This commit is contained in:
commit
33f94034e2
13 changed files with 78 additions and 7 deletions
|
@ -419,6 +419,7 @@ router.post('/field/:listId', (req, res) => {
|
|||
|
||||
let field = {
|
||||
name: (input.NAME || '').toString().trim(),
|
||||
description: (input.DESCRIPTION || '').toString().trim(),
|
||||
defaultValue: (input.DEFAULT || '').toString().trim() || null,
|
||||
type: (input.TYPE || '').toString().toLowerCase().trim(),
|
||||
group: Number(input.GROUP) || null,
|
||||
|
|
|
@ -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