christmas/views/wishlist.pug

242 lines
11 KiB
Text
Raw Normal View History

2018-11-20 11:19:58 -08:00
extends layout.pug
2019-11-18 12:53:21 -08:00
block title
h1
.level
.level-left
.level-item
2019-11-18 13:03:20 -08:00
button.button.is-rounded(onclick='this.firstChild.firstChild.classList.add("fa-pulse"); location.reload()')
2019-11-18 12:53:21 -08:00
span.icon
i.fas.fa-sync-alt
.level-item
2021-12-03 08:13:43 -08:00
span= lang('WISHLIST_TITLE', name)
2019-11-18 12:53:21 -08:00
2018-11-20 11:19:58 -08:00
block content
script(type='data/user_id')= req.user._id
2020-12-01 19:09:25 -08:00
if global._CC.config.wishlist.table
.box
table.table.has-mobile-cards
thead
th #
2021-12-03 08:13:43 -08:00
th(style='width: 15%;')= lang('WISHLIST_IMAGE')
th(style='width: 25%;')= lang('WISHLIST_NAME')
th(style='width: 50%;')= lang('WISHLIST_NOTE')
th(style='width: 10%;')= lang('WISHLIST_PRICE')
th= lang('WISHLIST_EDIT_ITEM')
th= lang('WISHLIST_ADDED_BY')
if req.params.user === req.user._id
2021-12-03 08:13:43 -08:00
th= lang('WISHLIST_MOVE_TOP')
th= lang('WISHLIST_MOVE_UP')
th= lang('WISHLIST_MOVE_DOWN')
else
2021-12-03 08:13:43 -08:00
th= lang('WISHLIST_PLEDGE')
2021-12-03 16:08:31 -08:00
th= lang('WISHLIST_DELETE')
tbody
each item, index in wishlist
if req.user._id === item.addedBy || req.params.user !== req.user._id
2019-11-17 15:05:45 -08:00
tr(id=item.id)
td.rank= index + 1
2020-11-02 14:43:57 -08:00
td
figure(style='width: 100%; margin: 0;')
2020-11-30 18:23:59 -08:00
img(src=item.image, style='width: 100%; max-height: 20em; object-fit: contain;')
if item.url
2019-11-17 06:05:10 -08:00
td.ugc(data-label='Name')
a(
href=item.url,
rel='noopener noreferrer',
target='_blank'
)= (item.name ? item.name : item.url)
else
2021-12-03 08:13:43 -08:00
td.ugc(data-label=lang('WISHLIST_NAME'))= item.name
2020-12-01 19:09:25 -08:00
if _CC.config.wishlist.note.markdown
2021-12-03 08:13:43 -08:00
td.ugc(data-label=lang('WISHLIST_NOTE'))
2020-12-02 09:18:17 -08:00
div!= item.note
2020-12-01 15:14:57 -08:00
else
2021-12-03 08:13:43 -08:00
td.ugc(data-label=lang('WISHLIST_NOTE'))= item.note
td.ugc(data-label=lang('WISHLIST_PRICE'))= item.price
td(data-label=lang('WISHLIST_EDIT_ITEM'))
2020-10-29 11:14:38 -07:00
form.inline(method='GET', action=`${_CC.config.base}wishlist/${req.params.user}/note/${item.id}`)
2019-11-17 04:20:04 -08:00
.field.inline
.control.inline
button.button.is-text(
type='submit',
style='text-decoration: none;'
disabled=item.addedBy !== req.user._id
2019-11-17 04:20:04 -08:00
)
span.icon
i.far.fa-edit
2021-12-03 08:13:43 -08:00
td.ugc(data-label=lang('WISHLIST_ADDED_BY'))= item.addedBy
if req.params.user === req.user._id
2021-12-03 08:13:43 -08:00
td(data-label=lang('WISHLIST_MOVE_ITEM_TOP'))
2021-01-02 14:17:20 -08:00
form.topForm.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/top/${item.id}`)
.field.inline
.control.inline
button.button.is-text(
type='submit',
style='text-decoration: none;',
disabled=index === firstCanSee
)
span.icon
i.fas.fa-angle-double-up
2021-12-03 08:13:43 -08:00
td(data-label=lang('WISHLIST_MOVE_ITEM_UP'))
2020-10-29 11:14:38 -07:00
form.upForm.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/up/${item.id}`)
.field.inline
.control.inline
button.button.is-text(
type='submit',
style='text-decoration: none;',
disabled=index === firstCanSee
)
span.icon
i.fas.fa-arrow-up
2021-12-03 08:13:43 -08:00
td(data-label=lang('WISHLIST_MOVE_ITEM_DOWN'))
2020-10-29 11:14:38 -07:00
form.downForm.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/down/${item.id}`)
.field.inline
.control.inline
button.button.is-text(
type='submit',
style='text-decoration: none;',
disabled=index === lastCanSee
)
span.icon
i.fas.fa-arrow-down
else
2021-12-03 08:13:43 -08:00
td(data-label=lang('WISHLIST_PLEDGE'))
if req.params.user !== req.user._id && !item.pledgedBy
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}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
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/unpledge/${item.id}`)
.field.inline
.control.inline
input.inline.button(type='submit' value='Unpledge')
2019-11-17 04:54:43 -08:00
if item.pledgedBy && item.pledgedBy !== req.user._id
2021-12-03 08:13:43 -08:00
span.ugc=lang('WISHLIST_PLEDGED', item.pledgedBy)
td(data-label='Delete Item')
2019-11-17 05:12:00 -08:00
form.inline(
method='POST',
2020-10-29 11:14:38 -07:00
action=`${_CC.config.base}wishlist/${req.params.user}/${req.user._id === req.params.user ? 'remove' : 'unpledge'}/${item.id}`
2019-11-17 05:12:00 -08:00
)
2019-11-17 04:20:04 -08:00
.field.inline
.control.inline
button.button.is-text(
type='submit',
style='text-decoration: none;',
disabled=item.addedBy !== req.user._id
2019-11-17 04:20:04 -08:00
)
span.icon
i.fas.fa-trash
2019-11-16 20:34:04 -08:00
else
each item, index in wishlist
if req.user._id === item.addedBy || req.params.user !== req.user._id
.box
2020-11-01 19:01:30 -08:00
if item.price
.tag
i.fas.fa-tag(style='margin-right: .5em;')
span= item.price
2019-11-16 20:34:04 -08:00
span.overflowWrap
2020-11-01 19:01:30 -08:00
if item.price
span= ' '
2019-11-16 20:34:04 -08:00
if item.url
a(
href=item.url,
rel='noopener noreferrer',
target='_blank'
)= (item.name ? item.name : item.url)
else
2019-11-16 20:34:04 -08:00
span= item.name
hr
2020-11-02 14:43:57 -08:00
if item.note || item.image
.columns
if item.image
.column
figure(style='width: 100%; padding: 2em;')
img(src=item.image, style='width: 100%;')
.column.is-three-quarters
if item.note
textarea.textarea.has-fixed-size(
style='height: 100%;'
readonly
)= item.note
2021-12-03 08:13:43 -08:00
span.overflowWrap=lang('WISHLIST_ADDED_BY', item.addedBy)
2019-11-16 20:34:04 -08:00
hr
div
if req.params.user !== req.user._id && !item.pledgedBy
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/pledge/${item.id}`)
2018-11-30 13:44:06 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button.is-primary(type='submit' value=lang('WISHLIST_PLEDGE'))
2019-11-16 20:34:04 -08:00
if item.pledgedBy === req.user._id
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/unpledge/${item.id}`)
2018-11-30 13:44:06 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button(type='submit' value=lang('WISHLIST_UNPLEDGE'))
2019-11-16 20:34:04 -08:00
if req.user._id === req.params.user
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/remove/${item.id}`)
2018-11-30 13:44:06 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button.is-warning(type='submit' value=lang('WISHLIST_DELETE'))
2019-11-16 20:34:04 -08:00
if req.user._id === req.params.user || req.user._id === item.addedBy
2020-10-29 11:14:38 -07:00
form.inline(method='GET', action=`${_CC.config.base}wishlist/${req.params.user}/note/${item.id}`)
2019-11-18 12:07:57 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button(type='submit', value=lang('WISHLIST_EDIT_ITEM'))
2019-11-16 20:34:04 -08:00
if index !== firstCanSee && req.user._id === req.params.user
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/up/${item.id}`)
2019-11-16 20:34:04 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button(type='submit' value=lang('WISHLIST_MOVE_ITEM_UP'))
2019-11-16 20:34:04 -08:00
if index !== lastCanSee && req.user._id === req.params.user
2020-10-29 11:14:38 -07:00
form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/down/${item.id}`)
2019-11-16 20:34:04 -08:00
.field.inline
.control.inline
2021-12-03 08:13:43 -08:00
input.inline.button(type='submit' value=lang('WISHLIST_MOVE_ITEM_DOWN'))
2018-11-20 11:19:58 -08:00
form(method='POST')
.field
2021-12-03 08:13:43 -08:00
label.label!=lang('WISHLIST_URL_LABEL')
2018-11-20 11:19:58 -08:00
.control.has-icons-left
2018-11-30 13:44:06 -08:00
input.input(
type='text',
name='itemUrlOrName',
2021-12-03 08:13:43 -08:00
placeholder=lang('WISHLIST_URL_PLACEHOLDER')
2018-11-30 13:44:06 -08:00
)
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
2021-12-03 08:13:43 -08:00
label.label= lang('WISHLIST_NOTE')
2018-11-30 13:55:55 -08:00
.control
2018-11-30 13:44:06 -08:00
textarea.textarea(
name='note',
2021-12-03 08:13:43 -08:00
placeholder=lang('WISHLIST_OPTIONAL')
2018-11-30 13:44:06 -08:00
)
2018-11-20 11:19:58 -08:00
.field
.control
2021-12-03 08:13:43 -08:00
input.button(type='submit' value=(req.user._id === req.params.user ? lang('WISHLIST_ADD') : lang('WISHLIST_PLEDGE_ITEM')))
2020-10-29 11:14:38 -07:00
script(src=`${_CC.config.base}js/wishlist.js`)
2019-12-03 13:42:51 -08:00
block print
h1 #{req.params.user}'s Wishlist
2019-12-03 14:15:26 -08:00
.print-gifts
each item, index in wishlist.filter(item => item.addedBy === req.params.user)
.print-gift(style='page-break-inside: avoid;')
2019-12-03 14:33:20 -08:00
if index > 0
hr(style='margin-top: .5em; margin-bottom: .5em; background-color: black;')
2020-11-01 19:01:30 -08:00
if item.price
.tag
i.fas.fa-tag(style='margin-right: .5em;')
span= item.price
span= ' '
2019-12-03 14:22:37 -08:00
span.is-size-6.ugc= item.name
2019-12-03 14:15:26 -08:00
span= ' '
2019-12-03 14:22:37 -08:00
span.ugc.has-text-grey= item.url
span.is-block Added by: #{item.addedBy}
2019-12-03 14:15:26 -08:00
if item.note
.box
2020-12-01 19:09:25 -08:00
if _CC.config.wishlist.note.markdown
2020-12-01 15:14:57 -08:00
span.is-block.ugc!= item.note
else
2021-12-03 16:08:31 -08:00
span.is-block.ugc= item.note