aboutsummaryrefslogtreecommitdiff
path: root/src/mixins/post.pug
blob: cbe236594967b9bea7160bec5c4a4fb75bd65524 (plain)
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
26
include ../utils
mixin post(p)
  article.post
    div.post-container
      div.post-text
        div.title-container
          a(href=`/comments/${p.id}`)
            != p.title
          span.domain   (#{p.domain})
        div.info-container 
          div.info-item#{fmtnum(p.ups)}
          div.info-item by u/#{p.author}
          div.info-item 
            a(href=`/r/${p.subreddit}`) r/#{p.subreddit}
          div.info-item 
            a(href=`/comments/${p.id}`) #{fmtnum (p.num_comments)} #{fmttxt(p.num_comments, 'comment')} 
      div.media-preview
        if p.post_hint == "image" || p.post_hint == "link"
          if p.thumbnail && p.thumbnail != "self" || p.thumbnail != "default"
            a(href=p.url)
              img(src=p.thumbnail width='100px' height='100px') 
        else if p.post_hint == "hosted:video"
          - var url = p.secure_media.reddit_video.dash_url
          a(href=url)
            video(src=url controls data-dashjs-player="" width='100px' height='100px')