CorpusOptions.vue 3.44 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
<template>
    <v-card
      outlined
      class="my-5"
    >
      <v-card-title class="justify-center py-6">
        <h2 class="display-1">Options du corpus</h2>
      </v-card-title>

      <v-form class="px-12">
Quentin David's avatar
Quentin David committed
11
12
13
14
15
16
17
18
19
20
21
22
        <v-row>
          <v-col cols="6">
            <v-select
              class="my-5"
              v-model="lang_select"
              :items="languages"
              label="Langue du corpus"
              required
              outlined
              max-width=80%
            ></v-select>
          </v-col>
23
          <v-divider/>
Quentin David's avatar
Quentin David committed
24
25
26
27
28
29
30
31
32
33
          <v-col cols="6">
            <v-card outlined class="px-5 py-4 mb-5">
              <v-card-title class="subtitle-2">Métadonnées (facultatif) 
              </v-card-title>
              <v-card-text>
                <v-text-field
                    class="mt-0"
                    v-model="author"
                    label="Auteur"
                ></v-text-field>
34

Quentin David's avatar
Quentin David committed
35
36
37
38
39
                <v-text-field
                    class="pt-0 mt-0"
                    v-model="date"
                    label="Date"
                ></v-text-field>
40

Quentin David's avatar
Quentin David committed
41
42
43
44
45
                <v-text-field
                    class="mt-0 pt-0"
                    v-model="type"
                    label="Type de document"
                ></v-text-field>
46

Quentin David's avatar
Quentin David committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
                <v-row
                  v-for="metadata in additional_metadata"
                  :key="metadata.id"
                >
                  <v-col>
                    <v-text-field 
                      class="mt-0 pt-0"
                      label="Nom de la métadonnée"
                      v-model="metadata.name"
                    ></v-text-field>
                  </v-col>
                  <v-col>
                    <v-text-field 
                      class="mt-0 pt-0"
                      label="Valeur de la métadonnée"
                      v-model="metadata.value"
                    ></v-text-field>
                  </v-col>
                  <v-col cols="1">
                    <v-btn icon @click="delete_metadata(metadata.id)">
                      <v-icon>fa-times</v-icon>
                    </v-btn>
                  </v-col>
                </v-row>
              </v-card-text>

              <v-card-actions>
                <v-btn elevation="6" @click="add_metadata()">
                  <v-icon>mdi-plus</v-icon> Ajouter une métadonnée
                </v-btn>
              </v-card-actions>
            </v-card>
          </v-col>
        </v-row>
    </v-form>
82
83
84
85
86
87
88
89
90
91
92
    </v-card>
</template>
<script>

    export default {
        data: () => ({
            lang_select: 'Français',
            languages: ['Français','Anglais','Mandarin','Roumain', 'Nahuatl', 'Multilingue'],
            author: '',
            date: '',
            type: '',
Quentin David's avatar
Quentin David committed
93
94
            additional_metadata_id: 0,
            additional_metadata: [],
95
        }),
Quentin David's avatar
Quentin David committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
        methods:
        {
          add_metadata : function() {
            this.additional_metadata_id += 1;
            this.additional_metadata.push({id: this.additional_metadata_id, name:"", value: ""})
          },
          delete_metadata: function(metadata_id) {
            var index = null;
            for (var i=0; i<this.additional_metadata.length; i++) {
              if (this.additional_metadata[i].id == metadata_id) {
                index = i;
              }
            }
            if (index !== null) {
              this.additional_metadata.splice(index, 1);
            }
          }
        },
114
115
    }
</script>