Merge branch 'develop' of ssh.gitgud.io:lambadalambda/pleroma-fe into develop

This commit is contained in:
Roger Braun 2016-12-05 20:49:58 +01:00
commit 026ab7c1df
14 changed files with 88 additions and 32 deletions

View file

@ -1,4 +1,4 @@
import nsfwImage from '../../assets/nsfw.jpg'
import nsfwImage from '../../assets/nsfw.png'
import fileTypeService from '../../services/file_type/file_type.service.js'
const Attachment = {
@ -7,17 +7,23 @@ const Attachment = {
'nsfw',
'statusId'
],
data: () => ({ nsfwImage }),
data: () => ({
nsfwImage,
showHidden: false
}),
computed: {
type () {
return fileTypeService.fileType(this.attachment.mimetype)
},
hidden () {
return this.nsfw && !this.showHidden
}
},
methods: {
showNsfw () {
this.$store.commit('setNsfw', { id: this.statusId, nsfw: false })
toggleHidden () {
this.showHidden = !this.showHidden
}
}
}
export default Attachment
export default Attachment

View file

@ -1,15 +1,18 @@
<template>
<div class="attachment">
<a class="image-attachment" v-if="nsfw" v-on:click.prevent="showNsfw()">
<a class="image-attachment" v-if="hidden" v-on:click.prevent="toggleHidden()">
<img :key="nsfwImage" :src="nsfwImage"></img>
</a>
<div class="hider" v-if="nsfw && !hidden">
<a href="#" @click.prevent="toggleHidden()">Hide</a>
</div>
<a class="image-attachment" v-if="type === 'image' && !nsfw"
<a class="image-attachment" v-if="type === 'image' && !hidden"
:href="attachment.url" target="_blank">
<img :src="attachment.url"></img>
</a>
<video v-if="type === 'video' && !nsfw" :src="attachment.url" controls></video>
<video v-if="type === 'video' && !hidden" :src="attachment.url" controls></video>
<audio v-if="type === 'audio'" :src="attachment.url" controls></audio>
@ -34,12 +37,20 @@
display: flex;
flex-wrap: wrap;
.attachment {
flex: 1 0 30%;
display: flex;
margin: 0.2em;
align-self: flex-start;
.hider {
position: absolute;
margin: 10px;
padding: 5px;
background: rgba(230,230,230,0.6);
border-radius: 0.5em;
font-weight: bold;
}
video {
height: 100%;
border: 1px solid;

View file

@ -20,7 +20,9 @@ const Status = {
},
loggedIn () {
return !!this.$store.state.users.currentUser
}
},
deleted () { return this.statusoid.deleted },
canDelete () { return this.statusoid.user.rights.delete_others_notice || this.statusoid.user.id == this.$store.state.users.currentUser.id }
},
components: {
Attachment,
@ -31,6 +33,12 @@ const Status = {
methods: {
toggleReplying () {
this.replying = !this.replying
},
deleteStatus () {
const confirmed = confirm('Do you really want to delete this status?')
if (confirmed) {
this.$store.dispatch('deleteStatus', { id: this.status.id })
}
}
}
}

View file

@ -1,8 +1,8 @@
<template>
<div class="status-el">
<div class="status-el" v-if="!status.deleted">
<div v-if="retweet" class="media container retweet-info">
<div class="media-left">
<i class='fa icon-retweet'></i>
<i class='fa icon-retweet retweeted'></i>
</div>
<div class="media-body">
Retweeted by {{retweeter}}
@ -52,6 +52,11 @@
</div>
<retweet-button :status=status></retweet-button>
<favorite-button :status=status></favorite-button>
<div v-if="canDelete">
<a href="#" v-on:click.prevent="deleteStatus">
<i class='fa icon-cancel delete-status'></i>
</a>
</div>
</div>
<post-status-form v-if="replying" :reply-to="status.id" :attentions="status.attentions" :repliedUser="status.user" v-on:posted="toggleReplying"></post-status-form>
@ -125,4 +130,11 @@
.status-el:last-child .status {
border: none
}
.icon-cancel,.delete-status {
cursor: pointer;
&:hover {
color: $red;
}
}
</style>

View file

@ -18,10 +18,3 @@
</div>
</template>
<script src="./timeline.js"></script>
<style>
.timeline.panel {
flex: 2;
flex-basis: 500px;
}
</style>

View file

@ -5,10 +5,3 @@
</template>
<script src="./user_profile.js"></script>
<style>
.user-profile {
flex: 2;
flex-basis: 500px;
}
</style>