table mode!
This commit is contained in:
parent
efee1e267e
commit
b5e1db2b61
2 changed files with 122 additions and 49 deletions
|
@ -40,6 +40,8 @@ services:
|
||||||
# Amazon Smile, set to 'false' to disable www.amazon.com links
|
# Amazon Smile, set to 'false' to disable www.amazon.com links
|
||||||
# turning into smile.amazon.com
|
# turning into smile.amazon.com
|
||||||
SMILE: 'true'
|
SMILE: 'true'
|
||||||
|
# Table mode, set to 'false' to revert to box mode
|
||||||
|
TABLE: 'true'
|
||||||
restart: always
|
restart: always
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -1,63 +1,134 @@
|
||||||
extends layout.pug
|
extends layout.pug
|
||||||
|
|
||||||
block content
|
block content
|
||||||
each item, index in wishlist
|
if process.env.TABLE !== 'false'
|
||||||
if req.user._id === item.addedBy || req.params.user !== req.user._id
|
table.table.has-mobile-cards
|
||||||
.box
|
thead
|
||||||
span.overflowWrap
|
th Name
|
||||||
if item.url
|
th Note
|
||||||
a(
|
th Edit Note
|
||||||
href=item.url,
|
if req.params.user === req.user._id
|
||||||
rel='noopener noreferrer',
|
th Move Up
|
||||||
target='_blank'
|
th Move Down
|
||||||
)= (item.name ? item.name : item.url)
|
th Delete
|
||||||
else
|
tbody
|
||||||
span= item.name
|
each item, index in wishlist
|
||||||
hr
|
tr
|
||||||
if item.note
|
if item.url
|
||||||
textarea.textarea.has-fixed-size(
|
td(data-label='Name')
|
||||||
rows=String(config.wishlist.note.rows),
|
a(
|
||||||
readonly
|
href=item.url,
|
||||||
)= item.note
|
rel='noopener noreferrer',
|
||||||
span.overflowWrap Added by: #{item.addedBy}
|
target='_blank'
|
||||||
hr
|
)= (item.name ? item.name : item.url)
|
||||||
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
|
else
|
||||||
|
td(data-label='Name')= item.name
|
||||||
|
td(data-label='Note', style='white-space: pre-wrap;')= item.note
|
||||||
|
td(data-label='Edit Note')
|
||||||
form.inline(method='GET', action=`/wishlist/${req.params.user}/note/${item.id}`)
|
form.inline(method='GET', action=`/wishlist/${req.params.user}/note/${item.id}`)
|
||||||
|
input(type='hidden', name='current', value=item.note)
|
||||||
.field.inline
|
.field.inline
|
||||||
.control.inline
|
.control.inline
|
||||||
input.inline.button(type='submit', value='Add note')
|
button.button.is-text(
|
||||||
if index !== firstCanSee && req.user._id === req.params.user
|
type='submit',
|
||||||
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/up/${item.id}`)
|
style='text-decoration: none;'
|
||||||
|
disabled=item.addedBy !== req.user._id
|
||||||
|
)
|
||||||
|
span.icon
|
||||||
|
i.far.fa-edit
|
||||||
|
if req.params.user === req.user._id
|
||||||
|
td(data-label='Move Item Up')
|
||||||
|
form.inline(method='POST', action=`/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='Move Item Down')
|
||||||
|
form.inline(method='POST', action=`/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
|
||||||
|
td(data-label='Delete Item')
|
||||||
|
if item.addedBy === req.user._id
|
||||||
|
form.inline(method='POST', action=`/wishlist/${req.params.user}/remove/${item.id}`)
|
||||||
|
.field.inline
|
||||||
|
.control.inline
|
||||||
|
button.button.is-text(
|
||||||
|
type='submit',
|
||||||
|
style='text-decoration: none;'
|
||||||
|
)
|
||||||
|
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
|
||||||
|
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
|
.field.inline
|
||||||
.control.inline
|
.control.inline
|
||||||
input.inline.button(type='submit' value='Move item up')
|
input.inline.button.is-primary(type='submit' value='Pledge')
|
||||||
if index !== lastCanSee && req.user._id === req.params.user
|
if item.pledgedBy === req.user._id
|
||||||
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/down/${item.id}`)
|
form.inline(method='POST', action=`/wishlist/${req.params.user}/unpledge/${item.id}`)
|
||||||
.field.inline
|
.field.inline
|
||||||
.control.inline
|
.control.inline
|
||||||
input.inline.button(type='submit' value='Move item down')
|
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
|
||||||
|
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
|
||||||
|
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
|
||||||
|
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')
|
||||||
form(method='POST')
|
form(method='POST')
|
||||||
.field
|
.field
|
||||||
label.label Item URL or Name
|
label.label Item URL or Name
|
||||||
|
|
Loading…
Reference in a new issue