/
_tweetCard.pug
25 lines (25 loc) · 992 Bytes
/
_tweetCard.pug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
mixin tweetCard(tweet={})
.tweet_card.tweet_hover
.tweet_avatar
a(href=`/${tweet.author.username}`)
img(src=`/uploads/${tweet.author.avatar || 'no-avatar.jpg'}`)
.tweet_text
p.author_name
a(href=`/${tweet.author.username}`)
strong #{tweet.author.name || tweet.author.username}
span @#{tweet.author.username}
p.the_tweet #{tweet.tweet}
p.tweet_actions
//- if user
//- form.heart(method='POST' action=`/api/tweets/${tweet._id}/heart`)
//- - const heartStrings = user.hearts.map(obj => obj.toString())
//- - const heartClass = heartStrings.includes(tweet._id.toString()) ? 'hearted' : ''
//- button(type='submit' name='heart' class=heartClass)
//- | ♥
p.tweet_meta
span
a(href=`/tweet/${tweet._id}` title=`${tweet.created}`) #{moment(tweet.created).fromNow()}
if user && (tweet.author.equals(user._id) || user.username == 'tamal')
span ·
span
a(href=`/delete/${tweet._id}`) Delete