forked from cory/tildefriends
Added a primitive like/react menu.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3745 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
@ -20,7 +20,25 @@ Vue.component('tf-message', {
|
||||
set_reply: function() {
|
||||
g_data.reply_root = this.content_json.root || this.message.id;
|
||||
g_data.reply_branch = this.message.id;
|
||||
}
|
||||
},
|
||||
vote: function(event) {
|
||||
var reaction = event.srcElement.innerText;
|
||||
var message = this.message.id;
|
||||
if (confirm('Are you sure you want to react with ' + reaction + ' to ' + message + '?')) {
|
||||
window.parent.postMessage(
|
||||
{
|
||||
appendMessage: {
|
||||
type: 'vote',
|
||||
vote: {
|
||||
link: message,
|
||||
value: 1,
|
||||
expression: reaction,
|
||||
},
|
||||
},
|
||||
},
|
||||
'*');
|
||||
}
|
||||
},
|
||||
},
|
||||
template: `<md-app class="md-elevation-8" style="margin: 1em" v-if="!content_json || ['pub', 'vote'].indexOf(content_json.type) == -1">
|
||||
<md-app-toolbar>
|
||||
@ -63,6 +81,16 @@ Vue.component('tf-message', {
|
||||
<md-chip v-for="vote in Object.keys(votes[message.id] || {})" v-bind:key="vote">
|
||||
{{vote + (votes[message.id][vote].length > 1 ? ' (' + votes[message.id][vote].length + ')' : '')}}
|
||||
</md-chip>
|
||||
<md-card-actions>
|
||||
<md-menu>
|
||||
<md-menu-content>
|
||||
<md-menu-item @click="vote">Like</md-menu-item>
|
||||
</md-menu-content>
|
||||
<md-button class="md-icon-button" md-menu-trigger>
|
||||
<md-icon>thumb_up</md-icon>
|
||||
</md-button>
|
||||
</md-menu>
|
||||
</md-card-actions>
|
||||
</md-app-content>
|
||||
</md-app>`,
|
||||
});
|
Reference in New Issue
Block a user