CorpusOptions.vue 4.39 KB
Newer Older
1
2
3
4
5
6
<template>
    <v-card
      outlined
      class="my-5"
    >
      <v-card-title class="justify-center py-6">
Quentin David's avatar
Quentin David committed
7
        <h2 class="display-1">{{ $t('corpus-option-title') }}</h2>
8
9
10
      </v-card-title>

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

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

Quentin David's avatar
Quentin David committed
41
42
43
                <v-text-field
                    class="mt-0 pt-0"
                    v-model="type"
Quentin David's avatar
Quentin David committed
44
                    :label="$t('metadata-corpus-type')"
Quentin David's avatar
Quentin David committed
45
                ></v-text-field>
46

Quentin David's avatar
Quentin David committed
47
48
49
50
51
52
53
                <v-row
                  v-for="metadata in additional_metadata"
                  :key="metadata.id"
                >
                  <v-col>
                    <v-text-field 
                      class="mt-0 pt-0"
Quentin David's avatar
Quentin David committed
54
                      :label="$t('metadata-additional-name')"
Quentin David's avatar
Quentin David committed
55
56
57
58
59
60
                      v-model="metadata.name"
                    ></v-text-field>
                  </v-col>
                  <v-col>
                    <v-text-field 
                      class="mt-0 pt-0"
Quentin David's avatar
Quentin David committed
61
                      :label="$t('metadata-additional-value')"
Quentin David's avatar
Quentin David committed
62
63
64
65
66
67
68
69
70
71
72
73
74
                      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()">
Quentin David's avatar
Quentin David committed
75
                  <v-icon>mdi-plus</v-icon> {{ $t('metadata-additional-button-label')}}
Quentin David's avatar
Quentin David committed
76
77
78
79
80
81
                </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
    }
Quentin David's avatar
Quentin David committed
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
</script>
<i18n>
{
  "fr":{
    "corpus-option-title":"Paramètres du corpus",
    "corpus-language":"Langue du corpus",
    "metadata-title":"Métadonnées (facultatif)",
    "metadata-author":"Auteur",
    "metadata-date":"Date",
    "metadata-corpus-type":"Type",
    "metadata-additional-name":"Nom de la métadonnée",
    "metadata-additional-value":"Valeur de la métadonnée",
    "metadata-additional-button-label":"Ajouter une métadonnée"
  },
  "en":{
    "corpus-option-title":"Parameters of the corpus",
    "corpus-language":"Corpus language",
    "metadata-title":"Metadata (not mandatory)",
    "metadata-author":"Author",
    "metadata-date":"Date",
    "metadata-corpus-type":"Type",
    "metadata-additional-name":"Name of the metadata",
    "metadata-additional-value":"Value of the metadata",
    "metadata-additional-button-label":"Add a metadata"
  }
}
</i18n>