Allow moving top one down and bottom one up

This commit is contained in:
Wingysam 2018-11-23 10:23:38 -05:00
parent 53869bcf6c
commit ddbaf05936

View file

@ -11,26 +11,27 @@ block content
span= item.name span= item.name
div div
if req.params.user !== req.user._id && !item.pledgedBy if req.params.user !== req.user._id && !item.pledgedBy
form(method='POST', action=`/wishlist/${req.params.user}/pledge/${item.id}`) form.inline(method='POST', action=`/wishlist/${req.params.user}/pledge/${item.id}`)
.field .field.inline
.control .control.inline
input.button.is-primary(type='submit' value='Pledge') input.inline.button.is-primary(type='submit' value='Pledge')
if item.pledgedBy === req.user._id if item.pledgedBy === req.user._id
form(method='POST', action=`/wishlist/${req.params.user}/unpledge/${item.id}`) form.inline(method='POST', action=`/wishlist/${req.params.user}/unpledge/${item.id}`)
.field .field.inline
.control .control.inline
input.button(type='submit' value='Unpledge') input.inline.button(type='submit' value='Unpledge')
if req.user._id === req.params.user if req.user._id === req.params.user
form.inline(method='POST', action=`/wishlist/${req.params.user}/remove/${item.id}`) form.inline(method='POST', action=`/wishlist/${req.params.user}/remove/${item.id}`)
.field.inline .field.inline
.control.inline .control.inline
input.inline.button.is-warning(type='submit' value='Remove') input.inline.button.is-warning(type='submit' value='Remove')
- console.log(lastCanSee); if req.user._id === req.params.user
if req.user._id === req.params.user && index !== 0 && index !== lastCanSee if index !== 0
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/up/${item.id}`) form.inline(method='POST', action=`/wishlist/${req.params.user}/move/up/${item.id}`)
.field.inline .field.inline
.control.inline .control.inline
input.inline.button(type='submit' value='Move item up') input.inline.button(type='submit' value='Move item up')
if index !== lastCanSee
form.inline(method='POST', action=`/wishlist/${req.params.user}/move/down/${item.id}`) form.inline(method='POST', action=`/wishlist/${req.params.user}/move/down/${item.id}`)
.field.inline .field.inline
.control.inline .control.inline