2019-07-24 20:50:45 +00:00
|
|
|
<template>
|
2019-11-28 11:04:05 +00:00
|
|
|
<main v-if="!userProfileLoading">
|
2019-07-24 20:50:45 +00:00
|
|
|
<header>
|
|
|
|
<el-avatar :src="user.avatar" size="large" />
|
|
|
|
<h1>{{ user.display_name }}</h1>
|
|
|
|
</header>
|
|
|
|
<el-row>
|
2019-10-01 19:54:13 +00:00
|
|
|
<el-col :span="8">
|
|
|
|
<el-card class="user-profile-card">
|
|
|
|
<div class="el-table el-table--fit el-table--enable-row-hover el-table--enable-row-transition el-table--medium">
|
|
|
|
<table class="user-profile-table">
|
|
|
|
<tbody>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td>{{ $t('userProfile.nickname') }}</td>
|
|
|
|
<td>
|
|
|
|
{{ user.nickname }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td class="name-col">ID</td>
|
|
|
|
<td class="value-col">
|
|
|
|
{{ user.id }}
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td>{{ $t('userProfile.tags') }}</td>
|
|
|
|
<td>
|
|
|
|
<el-tag v-for="tag in user.tags" :key="tag" class="user-profile-tag">{{ tag }}</el-tag>
|
|
|
|
<span v-if="user.tags.length === 0">—</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td>{{ $t('userProfile.roles') }}</td>
|
|
|
|
<td>
|
2019-10-04 15:49:03 +00:00
|
|
|
<el-tag v-if="user.roles.admin" class="user-profile-tag">
|
|
|
|
{{ $t('users.admin') }}
|
|
|
|
</el-tag>
|
|
|
|
<el-tag v-if="user.roles.moderator" class="user-profile-tag">
|
|
|
|
{{ $t('users.moderator') }}
|
|
|
|
</el-tag>
|
2019-10-01 19:54:13 +00:00
|
|
|
<span v-if="!user.roles.moderator && !user.roles.admin">—</span>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td>{{ $t('userProfile.localUppercase') }}</td>
|
|
|
|
<td>
|
|
|
|
<el-tag v-if="user.local" type="info">{{ $t('userProfile.local') }}</el-tag>
|
|
|
|
<el-tag v-if="!user.local" type="info">{{ $t('userProfile.external') }}</el-tag>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr class="el-table__row">
|
|
|
|
<td>{{ $t('userProfile.activeUppercase') }}</td>
|
|
|
|
<td>
|
|
|
|
<el-tag v-if="user.deactivated" type="success">{{ $t('userProfile.active') }}</el-tag>
|
|
|
|
<el-tag v-if="!user.deactivated" type="danger">{{ $t('userProfile.deactivated') }}</el-tag>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
</tbody>
|
|
|
|
</table>
|
|
|
|
</div>
|
|
|
|
</el-card>
|
2019-07-24 20:50:45 +00:00
|
|
|
</el-col>
|
|
|
|
<el-row type="flex" class="row-bg" justify="space-between">
|
2019-11-28 15:37:28 +00:00
|
|
|
<el-col :span="16">
|
2019-11-11 01:49:42 +00:00
|
|
|
<h2 class="recent-statuses">{{ $t('userProfile.recentStatuses') }}</h2>
|
|
|
|
</el-col>
|
2019-07-24 20:50:45 +00:00
|
|
|
<el-col :span="6" class="show-private">
|
|
|
|
<el-checkbox v-model="showPrivate" @change="onTogglePrivate">
|
|
|
|
{{ $t('userProfile.showPrivateStatuses') }}
|
|
|
|
</el-checkbox>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
<el-col :span="18">
|
2019-11-28 11:04:05 +00:00
|
|
|
<el-timeline v-if="!statusesLoading" class="statuses">
|
|
|
|
<el-timeline-item v-for="status in statuses" :key="status.id">
|
|
|
|
<status :status="status" :user-id="user.id" :godmode="showPrivate"/>
|
2019-07-24 20:50:45 +00:00
|
|
|
</el-timeline-item>
|
|
|
|
</el-timeline>
|
|
|
|
</el-col>
|
|
|
|
</el-row>
|
|
|
|
</main>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2019-11-28 11:04:05 +00:00
|
|
|
import Status from '../status/Status'
|
|
|
|
|
2019-07-24 20:50:45 +00:00
|
|
|
export default {
|
|
|
|
name: 'UsersShow',
|
2019-11-28 11:04:05 +00:00
|
|
|
components: { Status },
|
2019-07-24 20:50:45 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
showPrivate: false
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
2019-11-28 11:04:05 +00:00
|
|
|
statuses() {
|
|
|
|
return this.$store.state.userProfile.statuses
|
|
|
|
},
|
|
|
|
statusesLoading() {
|
|
|
|
return this.$store.state.userProfile.statusesLoading
|
2019-07-24 20:50:45 +00:00
|
|
|
},
|
|
|
|
user() {
|
|
|
|
return this.$store.state.userProfile.user
|
|
|
|
},
|
2019-11-28 11:04:05 +00:00
|
|
|
userProfileLoading() {
|
|
|
|
return this.$store.state.userProfile.userProfileLoading
|
2019-07-24 20:50:45 +00:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted: function() {
|
2019-11-28 11:04:05 +00:00
|
|
|
this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: false })
|
2019-07-24 20:50:45 +00:00
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
onTogglePrivate() {
|
2019-11-28 11:04:05 +00:00
|
|
|
this.$store.dispatch('FetchUserProfile', { userId: this.$route.params.id, godmode: this.showPrivate })
|
2019-07-24 20:50:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style rel='stylesheet/scss' lang='scss' scoped>
|
|
|
|
header {
|
|
|
|
align-items: center;
|
|
|
|
display: flex;
|
|
|
|
margin: 22px 0;
|
|
|
|
padding-left: 15px;
|
|
|
|
h1 {
|
|
|
|
margin: 0 0 0 10px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
table {
|
|
|
|
margin: 10px 0 0 15px;
|
|
|
|
.name-col {
|
|
|
|
width: 150px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
.el-table--border::after, .el-table--group::after, .el-table::before {
|
|
|
|
background-color: transparent;
|
|
|
|
}
|
|
|
|
.poll ul {
|
|
|
|
list-style-type: none;
|
|
|
|
padding: 0;
|
|
|
|
width: 30%;
|
|
|
|
}
|
|
|
|
.image {
|
|
|
|
width: 20%;
|
|
|
|
img {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
}
|
2019-10-01 19:54:13 +00:00
|
|
|
.recent-statuses-header {
|
|
|
|
margin-top: 10px;
|
|
|
|
}
|
2019-07-24 20:50:45 +00:00
|
|
|
.statuses {
|
2019-10-01 19:54:13 +00:00
|
|
|
padding: 0 20px 0 0;
|
2019-07-24 20:50:45 +00:00
|
|
|
}
|
|
|
|
.show-private {
|
|
|
|
text-align: right;
|
|
|
|
line-height: 67px;
|
|
|
|
padding-right: 20px;
|
|
|
|
}
|
2019-11-11 01:49:42 +00:00
|
|
|
.recent-statuses {
|
|
|
|
margin-left: 40px;
|
|
|
|
}
|
2019-10-01 19:54:13 +00:00
|
|
|
.user-profile-card {
|
|
|
|
margin-left: 15px;
|
|
|
|
margin-right: 20px;
|
|
|
|
}
|
|
|
|
.user-profile-table {
|
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
.user-profile-tag {
|
|
|
|
margin: 0 4px 4px 0;
|
|
|
|
}
|
2019-07-24 20:50:45 +00:00
|
|
|
</style>
|