You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
4.3 KiB
84 lines
4.3 KiB
3 years ago
|
mixin renderItemMetabar (dictionaryItem, itemType, options)
|
||
|
-
|
||
|
options = Object.assign({ hideActions: false }, options);
|
||
|
const decoratedItem = dictionaryItems.find((item) => item._id.equals(dictionaryItem._id));
|
||
|
if (decoratedItem) {
|
||
|
dictionaryItem = decoratedItem; // override it
|
||
|
}
|
||
|
var submitterName = (dictionaryItem.submitter.name && (dictionaryItem.submitter.name.length > 0)) ? dictionaryItem.submitter.name : '[Submitter Name Is Empty]';
|
||
|
var reportUrl = user ? `/content-report/${itemType}/${dictionaryItem._id}/submit` : '/welcome?src=report';
|
||
|
|
||
|
.frenspeak-metabar(data-item-type= itemType, data-item-id= dictionaryItem._id)
|
||
|
.metabar-submitter.uk-text-muted.uk-text-small(title="Submitted by")
|
||
|
div(uk-grid).uk-grid-collapse
|
||
|
.uk-width-auto
|
||
|
span(style="margin-right: 4px;") #{itemType} submitted by:
|
||
|
.uk-width-expand
|
||
|
a(href=`/user/${dictionaryItem.submitter._id}`).uk-text-truncate= submitterName
|
||
|
|
||
|
if !options.hideActions
|
||
|
div(uk-grid).uk-grid-collapse.uk-flex-bottom
|
||
|
.uk-width-expand
|
||
|
if user
|
||
|
button.metabar-button(
|
||
|
type="button",
|
||
|
title="Upvotes",
|
||
|
data-item-type= itemType,
|
||
|
data-item-id= dictionaryItem._id,
|
||
|
data-vote= "up",
|
||
|
onclick=`return window.dtp.app.processVote(event);`,
|
||
|
)
|
||
|
span(class={ 'uk-text-success': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'up') }).metabutton-icon.upvote-icon
|
||
|
i.fas.fa-thumbs-up
|
||
|
span.upvote-label.icon-label= numeral(dictionaryItem.stats.upVoteCount).format('0,0a')
|
||
|
|
||
|
button.metabar-button(
|
||
|
type="button",
|
||
|
title="Downvotes",
|
||
|
data-item-type= itemType,
|
||
|
data-item-id= dictionaryItem._id,
|
||
|
data-vote= "down",
|
||
|
onclick=`return window.dtp.app.processVote(event);`,
|
||
|
)
|
||
|
span(class={ 'uk-text-danger': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'down' ) }).metabutton-icon.downvote-icon
|
||
|
i.fas.fa-thumbs-down
|
||
|
span.downvote-label.icon-label= numeral(dictionaryItem.stats.downVoteCount).format('0,0a')
|
||
|
|
||
|
button.metabar-button(
|
||
|
type="button",
|
||
|
title="ReeeVotes",
|
||
|
data-item-type= itemType,
|
||
|
data-item-id= dictionaryItem._id,
|
||
|
data-vote= "reee",
|
||
|
onclick=`return window.dtp.app.processVote(event);`,
|
||
|
)
|
||
|
span(class={ 'uk-text-warning': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'reee') }).metabutton-icon.reeevote-icon
|
||
|
i.fas.fa-biohazard
|
||
|
span.reeevote-label.icon-label= numeral(dictionaryItem.stats.reeeVoteCount).format('0,0a')
|
||
|
else
|
||
|
a(href="/welcome?src=voting", title="Upvotes").metabar-button.uk-link-text
|
||
|
span(class={ 'uk-text-success': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'up') }).metabutton-icon.upvote-icon
|
||
|
i.fas.fa-thumbs-up
|
||
|
span.upvote-label.icon-label= numeral(dictionaryItem.stats.upVoteCount).format('0,0a')
|
||
|
|
||
|
a(href="/welcome?src=voting", title="Downvotes").metabar-button.uk-link-text
|
||
|
span(class={ 'uk-text-danger': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'down' ) }).metabutton-icon.downvote-icon
|
||
|
i.fas.fa-thumbs-down
|
||
|
span.downvote-label.icon-label= numeral(dictionaryItem.stats.downVoteCount).format('0,0a')
|
||
|
|
||
|
a(href="/welcome?src=voting", title="ReeeVotes").metabar-button.uk-link-text
|
||
|
span(class={ 'uk-text-warning': dictionaryItem.myVote && (dictionaryItem.myVote.vote === 'reee') }).metabutton-icon.reeevote-icon
|
||
|
i.fas.fa-biohazard
|
||
|
span.reeevote-label.icon-label= numeral(dictionaryItem.stats.reeeVoteCount).format('0,0a')
|
||
|
|
||
|
button(type="button").metabar-button
|
||
|
span.metabutton-icon
|
||
|
i.fas.fa-ellipsis-h
|
||
|
|
||
|
div(uk-dropdown={ mode: 'click' })
|
||
|
ul.uk-nav.uk-dropdown-nav
|
||
|
li
|
||
|
a(href= reportUrl) Report #{itemType}
|
||
|
|
||
|
.uk-width-auto
|
||
|
.uk-text-meta(title="Date submitted")= moment(dictionaryItem.created).format('MMM DD, YYYY')
|