Metadata.vue 2.46 KB
Newer Older
Markus Opolka's avatar
Markus Opolka committed
1
2
3
4
5
6
7
8
9
10
11
<template>
<v-container grid-list-md>
  <v-layout row wrap>
    <v-flex xs12>
      <h3>{{header}}</h3>
    </v-flex>

    <v-flex xs12>
      <v-card-title>
        <v-text-field
          append-icon="search"
Markus Opolka's avatar
Markus Opolka committed
12
          label="Recherche"
Markus Opolka's avatar
Markus Opolka committed
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
57
58
59
60
61
62
63
64
65
66
          single-line
          hide-details
          v-model="search"
          ></v-text-field>
      </v-card-title>
    </v-flex>

    <v-flex xs12 v-if="items">
      <v-data-table
        v-bind:headers="headers"
        v-bind:items="items"
        v-bind:search="search"
        hide-actions
        class="elevation-1"
        >
        <template slot="items" slot-scope="props">
          <td>
            <v-edit-dialog
              lazy
              > {{ props.item.title }}
              <v-text-field
                slot="input"
                label="Edit"
                v-model="props.item.title"
                single-line
                counter
                :rules="[max25chars]"
                ></v-text-field>
          </v-edit-dialog>
          </td>
          <td class="text-xs-right">{{ props.item.collection }}</td>
          <td class="text-xs-right">{{ props.item.author }}</td>
          <td class="text-xs-right">{{ props.item.recipient }}</td>
          <td class="text-xs-right">{{ props.item.gender }}</td>
          <td class="text-xs-right">{{ props.item.place }}</td>
          <td class="text-xs-right">{{ props.item.date }}</td>
        </template>
      </v-data-table>
    </v-flex>

    <!-- Progress Bar -->
    <v-flex xs12 v-else>
      <v-progress-linear indeterminate color="primary"></v-progress-linear>
    </v-flex>

  </v-layout>
 </v-container>
</template>

<script>
export default {
  data () {
    // Metadata Overview in Letters
    return {
Markus Opolka's avatar
Markus Opolka committed
67
      header: 'Métadonnées',
Markus Opolka's avatar
Markus Opolka committed
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
      max25chars: (v) => v.length <= 25 || 'Input too long!',
      tmp: '',
      search: '',
      pagination: {},
      headers: [
        {
          text: 'Document Metadata',
          align: 'left',
          sortable: false,
          value: 'title'
        },
        { text: 'Collection', value: 'collection' },
        { text: 'Author', value: 'author' },
        { text: 'Recipient', value: 'recipient' },
        { text: 'Gender', value: 'gender' },
        { text: 'Place', value: 'place' },
        { text: 'Date', value: 'date' }
      ],
      items: null
    }
  },
  created () {
    this.$http.get('http://localhost:3000/api/metadata/table').then(function (data) {
      this.items = data.body
    })
  }
}
</script>