Edit Note: s/Note/Item
This commit is contained in:
parent
23b1c5480c
commit
90c2c09c57
3 changed files with 29 additions and 22 deletions
|
@ -193,7 +193,9 @@ module.exports = (db) => {
|
|||
req.flash('error', 'Invalid user');
|
||||
return res.redirect(`/wishlist/${req.params.user}`);
|
||||
}
|
||||
wishlistItem.name = req.body.name;
|
||||
wishlistItem.note = req.body.note;
|
||||
wishlistItem.url = req.body.url;
|
||||
wishlist[i] = wishlistItem;
|
||||
}
|
||||
doc.wishlist = wishlist;
|
||||
|
|
|
@ -3,17 +3,23 @@ extends layout.pug
|
|||
block content
|
||||
a(href='..') <i class="fas fa-arrow-left"></i> Back to #{req.params.user}'s wishlist
|
||||
form.inline(method='POST', action=`/wishlist/${req.params.user}/note/${req.params.id}`)
|
||||
.columns
|
||||
.column
|
||||
.field
|
||||
label.label Name
|
||||
.control
|
||||
input.input(name='name', value=req.query.name)
|
||||
.column
|
||||
.field
|
||||
label.label URL
|
||||
.control
|
||||
input.input(name='url', value=req.query.url)
|
||||
.field
|
||||
label.label Note
|
||||
.control
|
||||
textarea.textarea(
|
||||
name='note'
|
||||
)= req.query.current
|
||||
)= req.query.note
|
||||
.field.inline
|
||||
.control.inline
|
||||
input.button.is-primary(type='submit' value='Save Note')
|
||||
if req.query.current
|
||||
form.inline(method='POST', style='margin-left: 1em;')
|
||||
.field.inline
|
||||
.control.inline
|
||||
input.button.is-danger(type='submit', value='Delete Note')
|
||||
input.button.is-primary(type='submit' value='Save Item')
|
|
@ -8,7 +8,7 @@ block content
|
|||
thead
|
||||
th(style='width: 25%;') Name
|
||||
th(style='width: 50%;') Note
|
||||
th Edit Note
|
||||
th Edit Item
|
||||
th Added By
|
||||
if req.params.user === req.user._id
|
||||
th Move Up
|
||||
|
@ -30,9 +30,11 @@ block content
|
|||
else
|
||||
td.ugc(data-label='Name')= item.name
|
||||
td.ugc(data-label='Note')= item.note
|
||||
td(data-label='Edit Note')
|
||||
td(data-label='Edit Item')
|
||||
form.inline(method='GET', action=`/wishlist/${req.params.user}/note/${item.id}`)
|
||||
input(type='hidden', name='current', value=item.note)
|
||||
input(type='hidden', name='name', value=item.name)
|
||||
input(type='hidden', name='note', value=item.note)
|
||||
input(type='hidden', name='url', value=item.url)
|
||||
.field.inline
|
||||
.control.inline
|
||||
button.button.is-text(
|
||||
|
@ -133,16 +135,13 @@ block content
|
|||
.control.inline
|
||||
input.inline.button.is-warning(type='submit' value='Remove')
|
||||
if req.user._id === req.params.user || req.user._id === item.addedBy
|
||||
if (item.note)
|
||||
form.inline(method='POST', action=`/wishlist/${req.params.user}/note/remove/${item.id}`)
|
||||
.field.inline
|
||||
.control.inline
|
||||
input.inline.button.is-warning(type='submit', value='Remove note')
|
||||
else
|
||||
form.inline(method='GET', action=`/wishlist/${req.params.user}/note/${item.id}`)
|
||||
input(type='hidden', name='name', value=item.name)
|
||||
input(type='hidden', name='note', value=item.note)
|
||||
input(type='hidden', name='url', value=item.url)
|
||||
.field.inline
|
||||
.control.inline
|
||||
input.inline.button(type='submit', value='Add note')
|
||||
input.inline.button(type='submit', value='Edit item')
|
||||
if index !== firstCanSee && req.user._id === req.params.user
|
||||
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/up/${item.id}`)
|
||||
.field.inline
|
||||
|
|
Loading…
Reference in a new issue