christmas/views/wishlist.pug

81 lines
3.3 KiB
Text
Raw Normal View History

2018-11-20 11:19:58 -08:00
extends layout.pug
block content
2018-11-23 07:12:28 -08:00
each item, index in wishlist
2018-11-20 11:19:58 -08:00
if req.user._id === item.addedBy || req.params.user !== req.user._id
.box
2018-11-30 13:44:06 -08:00
span.overflowWrap
if item.url
a(
href=item.url,
rel='noopener noreferrer',
target='_blank'
)= (item.name ? item.name : item.url)
else
span= item.name
hr
if item.note
textarea.textarea.has-fixed-size(
rows=String(config.wishlist.note.rows),
readonly
)= item.note
span.overflowWrap Added by: #{item.addedBy}
hr
div
if req.params.user !== req.user._id && !item.pledgedBy
form.inline(method='POST', action=`/wishlist/${req.params.user}/pledge/${item.id}`)
.field.inline
.control.inline
input.inline.button.is-primary(type='submit' value='Pledge')
if item.pledgedBy === req.user._id
form.inline(method='POST', action=`/wishlist/${req.params.user}/unpledge/${item.id}`)
.field.inline
.control.inline
input.inline.button(type='submit' value='Unpledge')
if req.user._id === req.params.user
form.inline(method='POST', action=`/wishlist/${req.params.user}/remove/${item.id}`)
.field.inline
.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
2018-11-30 13:44:06 -08:00
form.inline(method='GET', action=`/wishlist/${req.params.user}/note/${item.id}`)
.field.inline
.control.inline
input.inline.button(type='submit', value='Add note')
if index !== firstCanSee && req.user._id === req.params.user
2018-11-30 13:44:06 -08:00
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/up/${item.id}`)
.field.inline
.control.inline
input.inline.button(type='submit' value='Move item up')
if index !== lastCanSee && req.user._id === req.params.user
2018-11-30 13:44:06 -08:00
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/down/${item.id}`)
.field.inline
.control.inline
input.inline.button(type='submit' value='Move item down')
2018-11-20 11:19:58 -08:00
form(method='POST')
.field
label.label Item URL or Name
.control.has-icons-left
2018-11-30 13:44:06 -08:00
input.input(
type='text',
name='itemUrlOrName',
placeholder='https://www.amazon.com/dp/B00ZV9RDKK'
)
2018-11-20 11:19:58 -08:00
span.icon.is-small.is-left
i.fas.fa-gift
2018-11-30 13:44:06 -08:00
.field
label.label Note
2018-11-30 13:55:55 -08:00
.control
2018-11-30 13:44:06 -08:00
textarea.textarea(
name='note',
placeholder='Optional'
)
2018-11-20 11:19:58 -08:00
.field
.control
input.button(type='submit' value=(req.user._id === req.params.user ? 'Add item to wishlist' : 'Pledge item'))