.container
h2.title {{ _('News') }}
.header.flex.row.justify-space-between
.group.sort
a.link(@click="changeSort('-votes')", :class="{ active: sort == '-votes' }") {{ _("Hot") }}
a.link(@click="changeSort('-views')", :class="{ active: sort == '-views' }") {{ _("MostViewed") }}
a.link(@click="changeSort('-createdAt')", :class="{ active: sort == '-createdAt' }") {{ _("New") }}
button.button.primary(@click="newPost")
span.icon
i.fa.fa-plus
span {{ _("NewPost") }}
.group.filter
a.link(@click="changeViewMode('all')", :class="{ active: viewMode == 'all' }") {{ _("AllPosts") }}
a.link(@click="changeViewMode('my')", :class="{ active: viewMode == 'my' }") {{ _("MyPosts") }}
.postForm(v-if="showForm")
vue-form-generator(:schema='schema', :model='model', :options='{}', :multiple="false", ref="form", :is-new-model="isNewPost")
.group.buttons
button.button.primary(@click="savePost") {{ _("Save") }}
button.button(@click="cancelPost") {{ _("Cancel") }}
transition-group.posts(name="post", tag="ul")
li(v-for="post of posts", :key="post.code")
article.media
.media-left
img.avatar(:src="post.author.avatar")
.votes(:class="{ voted: iVoted(post) }")
.count.text-center {{ post.votes }}
.thumb.text-center(@click="toggleVote(post)")
i.fa.fa-thumbs-o-up
.media-content
h3 {{ post.title }}
p.content(v-html="markdown(post.content)")
hr.full
.row
.functions.left
a(:title="_('EditPost')", @click="editPost(post)")
i.fa.fa-pencil
a(:title="_('DeletePost')", @click="deletePost(post)")
i.fa.fa-trash
.voters.left(:title="_('Voters')")
template(v-for="voter in lastVoters(post)")
img(:src="voter.avatar", :title="voter.fullName + ' (' + voter.username + ')'")
.right.text-right
template(v-if="post.editedAt")
small.text-muted {{ editedAgo(post) }}
br
small.text-muted {{ createdAgo(post) }}
.loadMore.text-center(v-if="hasMore")
button.button.outline(@click="loadMoreRows", :class="{ 'loading': fetching }") {{ _("LoadMore") }}
.noMore.text-center(v-if="!hasMore")
span.text-muted You reached the end of the list.
hr