mixin renderPostList (posts)
  if Array.isArray(posts) && (posts.length > 0)
    ul.uk-list.uk-list-divider
      each post in posts
        li
          a(href=`/post/${post.slug}`).uk-display-block
            div= post.title

          .uk-article-meta
            div(uk-grid).uk-grid-small.uk-text-small
              .uk-width-expand
                a(href=`/post/${post.slug}`)= moment(post.created).fromNow()
                if posts.all
                  span  by 
                    a(href=`/user/${post.author.username}`)=` ${post.author.username}`
              .uk-width-auto
                a(href=`/post/${post._id}/edit`).uk-display-block
                  +renderButtonIcon('fa-pen', 'edit')

              .uk-width-auto
                a(
                  href="",
                  data-post-id= post._id,
                  data-post-title= post.title,
                  onclick="return dtp.app.deletePost(event);",
                ).uk-display-block.uk-text-danger
                  +renderButtonIcon('fa-trash', 'delete')

              div(style="width: 65px;")
                span
                  i.fas.fa-eye
                span.uk-margin-small-left= formatCount(post.stats.totalVisitCount)
  else
    .uk-margin-small There are no posts.

mixin renderPublishedPostList (posts)
  if Array.isArray(posts) && (posts.length > 0)
    ul.uk-list.uk-list-divider
      each post in posts
        li
          a(href=`/post/${post.slug}`).uk-display-block
            div= post.title

          .uk-article-meta
            div(uk-grid).uk-grid-small.uk-text-small
              .uk-width-expand
                a(href=`/post/${post.slug}`)= moment(post.created).fromNow()
                if posts.all
                  span  by 
                    a(href=`/user/${post.author.username}`)=` ${post.author.username}`
              .uk-width-auto
                a(href=`/post/${post._id}/edit`).uk-display-block
                  +renderButtonIcon('fa-pen', 'edit')

              .uk-width-auto
                a(
                  href="",
                  data-post-id= post._id,
                  data-post-title= post.title,
                  onclick="return dtp.app.deletePost(event);",
                ).uk-display-block.uk-text-danger
                  +renderButtonIcon('fa-trash', 'delete')

              div(style="width: 65px;")
                span
                  i.fas.fa-eye
                span.uk-margin-small-left= formatCount(post.stats.totalVisitCount)
    +renderPaginationBar('/author/posts', posts.totalPostCount)
  else
    .uk-margin-small No published posts.