NotesThread.vue 1.41 KB
Newer Older
1
2
3
4
5
6
7
8
<template>
  <div class="ui feed">
    <div class="event" v-for="note in notes" :key="note.uuid">
      <div class="label">
        <i class="comment outline icon"></i>
      </div>
      <div class="content">
        <div class="summary">
9
          <actor-link :admin="true" :actor="note.author"></actor-link>
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
          <div class="date">
            <human-date :date="note.creation_date"></human-date>
          </div>
        </div>
        <div class="extra text">
          <expandable-div :content="note.summary">
            <div v-html="markdown.makeHtml(note.summary)"></div>
          </expandable-div>
        </div>
        <div class="meta">
          <a role="button" @click.prevent="remove(note)">
            <i class="trash icon"></i> <translate translate-context="*/*/*/Verb">Delete</translate>
          </a>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import axios from 'axios'
import showdown from 'showdown'

export default {
  props: {
    notes: {required: true},
  },
  data () {
      return {
      markdown: new showdown.Converter(),
      isLoading: false,
    }
  },
  methods: {
    remove (obj) {
      let self = this
      this.isLoading = true
      axios.delete(`manage/moderation/notes/${obj.uuid}/`).then((response) => {
        self.$emit('deleted', obj.uuid)
        self.isLoading = false
      }, error => {
        self.isLoading = false
      })
    },
  }
}
</script>