Result.vue 1.66 KB
Newer Older
1
2
3
4
5
6
<template>
  <v-card>
    <v-card-title primary-title>
      <span class="title">{{letter.name}}</span><v-chip label color="lime accent-4">{{letter.collection}}</v-chip>
      <v-chip color="indigo" text-color="white" v-if="letter.hits">
        <v-avatar class="indigo darken-4">{{letter.hits}}</v-avatar>
Markus Opolka's avatar
Markus Opolka committed
7
        résultat(s)
8
9
10
11
12
13
14
15
      </v-chip>
    </v-card-title>
    <v-card-text>
      <ul style="list-style-type:none;">
        <li v-for="hit in letter.results">
          <v-chip outline small color="secondary"> {{hit._text}} </v-chip>

          <v-chip label small v-if="has(hit, '_attributes')">
Markus Opolka's avatar
Markus Opolka committed
16
            <span v-if="has(hit._attributes, 'no')" >Ligne: {{(hit._attributes.no)}}</span>
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
            <span v-if="has(hit._attributes, 'category')" >Category: {{(hit._attributes.category)}}</span>
            <span v-if="has(hit._attributes, 'type')" >, Type: {{(hit._attributes.type)}}</span>
            <span v-if="has(hit._attributes, 'subtype')" >, Subtype: {{(hit._attributes.subtype)}}</span>
          </v-chip>

          <v-chip label small
                  text-color="white"
                  color="deep-orange darken-4"
                  v-if="has(hit._attributes, 'ref')">
            Line: {{(hit._attributes.ref)}}
          </v-chip>

        </li>
      </ul>
    </v-card-text>
    <v-card-actions>
Markus Opolka's avatar
Markus Opolka committed
33
      <v-btn :to="letter.link" flat>Montrer</v-btn>
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
    </v-card-actions>
  </v-card>
</template>

<script>
export default {
  // Component for Results in Search
  data () {
    return {
      data: null
    }
  },
  methods: {
    has (object, key) {
      return object ? hasOwnProperty.call(object, key) : false
    }
  },
  props: {
    letter: null
  }
}
</script>