forked from cory/tildefriends
25 lines
758 B
JavaScript
25 lines
758 B
JavaScript
|
"use strict";
|
||
|
Vue.component('tf-user', {
|
||
|
props: ['id'],
|
||
|
computed: {
|
||
|
following: {
|
||
|
get: function() {
|
||
|
return g_data.users &&
|
||
|
g_data.users[g_data.whoami] &&
|
||
|
g_data.users[g_data.whoami].following &&
|
||
|
g_data.users[g_data.whoami].following[this.id];
|
||
|
},
|
||
|
},
|
||
|
whoami: { get: function() { return g_data.whoami; } },
|
||
|
users: { get: function() { return g_data.users; } },
|
||
|
},
|
||
|
methods: {
|
||
|
show_user: function() {
|
||
|
window.parent.postMessage({action: 'setHash', hash: this.id}, '*');
|
||
|
},
|
||
|
},
|
||
|
template: `<md-chip md-clickable :class="following ? 'md-accent' : ''" @click="show_user()">
|
||
|
{{users[id] && users[id].name ? users[id].name : id}}
|
||
|
<md-tooltip v-if="users[id] && users[id].name">{{id}}</md-tooltip>
|
||
|
</md-chip>`,
|
||
|
});
|