From 63289215865387f0c74066dc057659608324f8c8 Mon Sep 17 00:00:00 2001 From: Wingy Date: Mon, 6 Dec 2021 13:39:55 -0500 Subject: [PATCH] Revert "fixed in #18a1c11" This reverts commit 2bbce4b492b9020e8171884bfaa2234feba887ff. --- views/wishlist.pug | 241 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 241 insertions(+) create mode 100644 views/wishlist.pug diff --git a/views/wishlist.pug b/views/wishlist.pug new file mode 100644 index 0000000..6b2e5c1 --- /dev/null +++ b/views/wishlist.pug @@ -0,0 +1,241 @@ +extends layout.pug + +block title + h1 + .level + .level-left + .level-item + button.button.is-rounded(onclick='this.firstChild.firstChild.classList.add("fa-pulse"); location.reload()') + span.icon + i.fas.fa-sync-alt + .level-item + span= lang('WISHLIST_TITLE', name) + +block content + script(type='data/user_id')= req.user._id + if global._CC.config.wishlist.table + .box + table.table.has-mobile-cards + thead + th # + 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 + th= lang('WISHLIST_MOVE_TOP') + th= lang('WISHLIST_MOVE_UP') + th= lang('WISHLIST_MOVE_DOWN') + else + th= lang('WISHLIST_PLEDGE') + th= lang('WISHLIST_DELETE') + tbody + each item, index in wishlist + if req.user._id === item.addedBy || req.params.user !== req.user._id + tr(id=item.id) + td.rank= index + 1 + td + figure(style='width: 100%; margin: 0;') + img(src=item.image, style='width: 100%; max-height: 20em; object-fit: contain;') + if item.url + td.ugc(data-label='Name') + a( + href=item.url, + rel='noopener noreferrer', + target='_blank' + )= (item.name ? item.name : item.url) + else + td.ugc(data-label=lang('WISHLIST_NAME'))= item.name + if _CC.config.wishlist.note.markdown + td.ugc(data-label=lang('WISHLIST_NOTE')) + div!= item.note + else + 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')) + form.inline(method='GET', action=`${_CC.config.base}wishlist/${req.params.user}/note/${item.id}`) + .field.inline + .control.inline + button.button.is-text( + type='submit', + style='text-decoration: none;' + disabled=item.addedBy !== req.user._id + ) + span.icon + i.far.fa-edit + td.ugc(data-label=lang('WISHLIST_ADDED_BY'))= item.addedBy + if req.params.user === req.user._id + td(data-label=lang('WISHLIST_MOVE_ITEM_TOP')) + 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 + td(data-label=lang('WISHLIST_MOVE_ITEM_UP')) + 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 + td(data-label=lang('WISHLIST_MOVE_ITEM_DOWN')) + 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 + td(data-label=lang('WISHLIST_PLEDGE')) + if req.params.user !== req.user._id && !item.pledgedBy + 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=lang('WISHLIST_PLEDGE_ITEM')) + if item.pledgedBy === req.user._id + 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=lang('WISHLIST_UNPLEDGE')) + if item.pledgedBy && item.pledgedBy !== req.user._id + span.ugc=lang('WISHLIST_PLEDGED', item.pledgedBy) + td(data-label='Delete Item') + form.inline( + method='POST', + action=`${_CC.config.base}wishlist/${req.params.user}/${req.user._id === req.params.user ? 'remove' : 'unpledge'}/${item.id}` + ) + .field.inline + .control.inline + button.button.is-text( + type='submit', + style='text-decoration: none;', + disabled=item.addedBy !== req.user._id + ) + span.icon + i.fas.fa-trash + + else + each item, index in wishlist + if req.user._id === item.addedBy || req.params.user !== req.user._id + .box + if item.price + .tag + i.fas.fa-tag(style='margin-right: .5em;') + span= item.price + span.overflowWrap + if item.price + span= ' ' + 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 || 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 + span.overflowWrap=lang('WISHLIST_ADDED_BY', item.addedBy) + hr + div + if req.params.user !== req.user._id && !item.pledgedBy + 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=lang('WISHLIST_PLEDGE')) + if item.pledgedBy === req.user._id + 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=lang('WISHLIST_UNPLEDGE')) + if req.user._id === req.params.user + form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/remove/${item.id}`) + .field.inline + .control.inline + input.inline.button.is-warning(type='submit' value=lang('WISHLIST_DELETE')) + if req.user._id === req.params.user || req.user._id === item.addedBy + form.inline(method='GET', action=`${_CC.config.base}wishlist/${req.params.user}/note/${item.id}`) + .field.inline + .control.inline + input.inline.button(type='submit', value=lang('WISHLIST_EDIT_ITEM')) + if index !== firstCanSee && req.user._id === req.params.user + form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/up/${item.id}`) + .field.inline + .control.inline + input.inline.button(type='submit' value=lang('WISHLIST_MOVE_ITEM_UP')) + if index !== lastCanSee && req.user._id === req.params.user + form.inline(method='POST', action=`${_CC.config.base}wishlist/${req.params.user}/move/down/${item.id}`) + .field.inline + .control.inline + input.inline.button(type='submit' value=lang('WISHLIST_MOVE_ITEM_DOWN')) + form(method='POST') + .field + label.label!=lang('WISHLIST_URL_LABEL') + .control.has-icons-left + input.input( + type='text', + name='itemUrlOrName', + placeholder=lang('WISHLIST_URL_PLACEHOLDER') + ) + span.icon.is-small.is-left + i.fas.fa-gift + .field + label.label= lang('WISHLIST_NOTE') + .control + textarea.textarea( + name='note', + placeholder=lang('WISHLIST_OPTIONAL') + ) + .field + .control + input.button(type='submit' value=(req.user._id === req.params.user ? lang('WISHLIST_ADD') : lang('WISHLIST_PLEDGE_ITEM'))) + script(src=`${_CC.config.base}js/wishlist.js`) + +block print + h1 #{req.params.user}'s Wishlist + .print-gifts + each item, index in wishlist.filter(item => item.addedBy === req.params.user) + .print-gift(style='page-break-inside: avoid;') + if index > 0 + hr(style='margin-top: .5em; margin-bottom: .5em; background-color: black;') + if item.price + .tag + i.fas.fa-tag(style='margin-right: .5em;') + span= item.price + span= ' ' + span.is-size-6.ugc= item.name + span= ' ' + span.ugc.has-text-grey= item.url + span.is-block Added by: #{item.addedBy} + if item.note + .box + if _CC.config.wishlist.note.markdown + span.is-block.ugc!= item.note + else + span.is-block.ugc= item.note