fix #1 - description link clickable
This commit is contained in:
@@ -34,7 +34,6 @@ const eventController = {
|
|||||||
},
|
},
|
||||||
async updatePlace (req, res) {
|
async updatePlace (req, res) {
|
||||||
const place = await Place.findByPk(req.body.id)
|
const place = await Place.findByPk(req.body.id)
|
||||||
console.log(place)
|
|
||||||
await place.update(req.body)
|
await place.update(req.body)
|
||||||
res.json(place)
|
res.json(place)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -52,11 +52,14 @@ const userController = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
async addEvent (req, res, next) {
|
async addEvent (req, res) {
|
||||||
const body = req.body
|
const body = req.body
|
||||||
|
const description = body.description
|
||||||
|
.replace(/(<([^>]+)>)/ig, '')
|
||||||
|
.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>')
|
||||||
const eventDetails = {
|
const eventDetails = {
|
||||||
title: body.title,
|
title: body.title,
|
||||||
description: body.description,
|
description,
|
||||||
multidate: body.multidate,
|
multidate: body.multidate,
|
||||||
start_datetime: body.start_datetime,
|
start_datetime: body.start_datetime,
|
||||||
end_datetime: body.end_datetime
|
end_datetime: body.end_datetime
|
||||||
@@ -99,6 +102,11 @@ const userController = {
|
|||||||
async updateEvent (req, res) {
|
async updateEvent (req, res) {
|
||||||
const body = req.body
|
const body = req.body
|
||||||
const event = await Event.findByPk(body.id)
|
const event = await Event.findByPk(body.id)
|
||||||
|
|
||||||
|
body.description = body.description
|
||||||
|
.replace(/(<([^>]+)>)/ig, '') // remove all tags from description
|
||||||
|
.replace(/(https?:\/\/[^\s]+)/g, '<a href="$1">$1</a>') // add links
|
||||||
|
|
||||||
await event.update(body)
|
await event.update(body)
|
||||||
let place
|
let place
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -23,4 +23,8 @@ pre {
|
|||||||
|
|
||||||
.el-tag:hover {
|
.el-tag:hover {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
a, a:hover {
|
||||||
|
color: orange;
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
span {{event.place.name}} - {{event.place.address}}
|
span {{event.place.name}} - {{event.place.address}}
|
||||||
br
|
br
|
||||||
b-card-body(v-if='event.description || event.tags')
|
b-card-body(v-if='event.description || event.tags')
|
||||||
pre {{event.description}}
|
pre(v-html='event.description')
|
||||||
br
|
br
|
||||||
el-tag.mr-1(:color='tag.color' v-for='tag in event.tags'
|
el-tag.mr-1(:color='tag.color' v-for='tag in event.tags'
|
||||||
size='mini') {{tag.tag}}
|
size='mini') {{tag.tag}}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ export default {
|
|||||||
this.time.start = moment(event.start_datetime).format('HH:mm')
|
this.time.start = moment(event.start_datetime).format('HH:mm')
|
||||||
this.time.end = moment(event.end_datetime).format('HH:mm')
|
this.time.end = moment(event.end_datetime).format('HH:mm')
|
||||||
this.event.title = event.title
|
this.event.title = event.title
|
||||||
this.event.description = event.description
|
this.event.description = event.description.replace(/(<([^>]+)>)/ig, '')
|
||||||
this.event.id = event.id
|
this.event.id = event.id
|
||||||
if (event.tags) {
|
if (event.tags) {
|
||||||
this.event.tags = event.tags.map(t => t.tag)
|
this.event.tags = event.tags.map(t => t.tag)
|
||||||
|
|||||||
Reference in New Issue
Block a user