mirror of
https://ghfast.top/https://github.com/discourse/discourse-topic-voting.git
synced 2026-07-16 11:26:36 +08:00
27 lines
718 B
JavaScript
27 lines
718 B
JavaScript
import { createWidget } from 'discourse/widgets/widget';
|
|
import { h } from 'virtual-dom';
|
|
|
|
export default createWidget('vote-options', {
|
|
tagName: 'div.vote-options',
|
|
|
|
buildClasses() {
|
|
return 'voting-popup-menu popup-menu hidden';
|
|
},
|
|
|
|
html(attrs){
|
|
var contents = [];
|
|
|
|
if (attrs.user_voted){
|
|
contents.push(this.attach('remove-vote', attrs));
|
|
}
|
|
else if (this.currentUser && this.currentUser.votes_exceeded && !attrs.user_voted) {
|
|
contents.push([
|
|
h("div", I18n.t("voting.reached_limit")),
|
|
h("p",
|
|
h("a",{ href: this.currentUser.get("path") + "/activity/votes" }, I18n.t("voting.list_votes"))
|
|
)
|
|
]);
|
|
}
|
|
return contents;
|
|
}
|
|
});
|