diff options
| author | lambadalambda <gitgud@rogerbraun.net> | 2016-12-05 07:09:35 -0500 |
|---|---|---|
| committer | lambadalambda <gitgud@rogerbraun.net> | 2016-12-05 07:09:35 -0500 |
| commit | be5fe03972879add14ce2ca6b37524b32adbf1b8 (patch) | |
| tree | ad05cec7702c10dd8f34d1e906a06c5c74a9c766 /src/components | |
| parent | 3c702feacae761d51c40417bdcc15fe13a26a85b (diff) | |
| parent | 75fdc72e222dee612137e4521dab1e44191948bb (diff) | |
Merge branch 'feature/delete_status' into 'develop'
Implements feature status delete
Fixes issue #4
See merge request !6
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/status/status.js | 10 | ||||
| -rw-r--r-- | src/components/status/status.vue | 14 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/components/status/status.js b/src/components/status/status.js index 0bf2ecde..8b2561cf 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -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 }) + } } } } diff --git a/src/components/status/status.vue b/src/components/status/status.vue index 9c32e7cb..6b9bca5b 100644 --- a/src/components/status/status.vue +++ b/src/components/status/status.vue @@ -1,5 +1,5 @@ <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 retweeted'></i> @@ -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> |
