Image support
This commit is contained in:
parent
b62ac06bd1
commit
96588d0690
3 changed files with 22 additions and 6 deletions
|
@ -206,7 +206,7 @@ module.exports = (db) => {
|
||||||
return res.redirect(`/wishlist/${req.params.user}`);
|
return res.redirect(`/wishlist/${req.params.user}`);
|
||||||
}
|
}
|
||||||
for (const type of [
|
for (const type of [
|
||||||
'name', 'note', 'url', 'price'
|
'name', 'note', 'url', 'price', 'image'
|
||||||
]) {
|
]) {
|
||||||
if (!req.body.hasOwnProperty(type)) {
|
if (!req.body.hasOwnProperty(type)) {
|
||||||
req.flash('error', `Missing property ${type}`)
|
req.flash('error', `Missing property ${type}`)
|
||||||
|
|
|
@ -19,6 +19,11 @@ block content
|
||||||
label.label Price
|
label.label Price
|
||||||
.control
|
.control
|
||||||
input.input(name='price', value=item.price)
|
input.input(name='price', value=item.price)
|
||||||
|
.column
|
||||||
|
.field
|
||||||
|
label.label Image URL
|
||||||
|
.control
|
||||||
|
input.input(name='image', value=item.image)
|
||||||
.field
|
.field
|
||||||
label.label Note
|
label.label Note
|
||||||
.control
|
.control
|
||||||
|
|
|
@ -17,6 +17,7 @@ block content
|
||||||
.box
|
.box
|
||||||
table.table.has-mobile-cards
|
table.table.has-mobile-cards
|
||||||
thead
|
thead
|
||||||
|
th(style='width: 15%;') Image
|
||||||
th(style='width: 25%;') Name
|
th(style='width: 25%;') Name
|
||||||
th(style='width: 50%;') Note
|
th(style='width: 50%;') Note
|
||||||
th(style='width: 10%;') Price
|
th(style='width: 10%;') Price
|
||||||
|
@ -32,6 +33,9 @@ block content
|
||||||
each item, index in wishlist
|
each item, index in wishlist
|
||||||
if req.user._id === item.addedBy || req.params.user !== req.user._id
|
if req.user._id === item.addedBy || req.params.user !== req.user._id
|
||||||
tr(id=item.id)
|
tr(id=item.id)
|
||||||
|
td
|
||||||
|
figure(style='width: 100%; margin: 0;')
|
||||||
|
img(src=item.image, style='width: 100%;')
|
||||||
if item.url
|
if item.url
|
||||||
td.ugc(data-label='Name')
|
td.ugc(data-label='Name')
|
||||||
a(
|
a(
|
||||||
|
@ -127,9 +131,16 @@ block content
|
||||||
else
|
else
|
||||||
span= item.name
|
span= item.name
|
||||||
hr
|
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
|
if item.note
|
||||||
textarea.textarea.has-fixed-size(
|
textarea.textarea.has-fixed-size(
|
||||||
rows=String(config.wishlist.note.rows),
|
style='height: 100%;'
|
||||||
readonly
|
readonly
|
||||||
)= item.note
|
)= item.note
|
||||||
span.overflowWrap Added by: #{item.addedBy}
|
span.overflowWrap Added by: #{item.addedBy}
|
||||||
|
|
Loading…
Reference in a new issue