Browse Source

Update paginator

pull/341/head
Hironsan 5 years ago
parent
commit
3f4c7d03d0
3 changed files with 38 additions and 10 deletions
  1. 9
      frontend/components/containers/EntityItemBox.vue
  2. 36
      frontend/components/containers/Paginator.vue
  3. 3
      frontend/pages/projects/_id/annotation/index.vue

9
frontend/components/containers/EntityItemBox.vue

@ -1,6 +1,6 @@
<template> <template>
<entity-item-box <entity-item-box
v-if="currentDoc"
v-if="isReady"
:labels="items" :labels="items"
:text="currentDoc.text" :text="currentDoc.text"
:entities="currentDoc.annotations" :entities="currentDoc.annotations"
@ -20,8 +20,11 @@ export default {
}, },
computed: { computed: {
...mapState('labels', ['items']),
...mapGetters('documents', ['currentDoc'])
...mapState('labels', ['items', 'loading']),
...mapGetters('documents', ['currentDoc']),
isReady() {
return !!this.currentDoc && !this.loading
}
}, },
created() { created() {

36
frontend/components/containers/Paginator.vue

@ -1,9 +1,27 @@
<template> <template>
<v-pagination
v-model="page"
:length="total"
:total-visible="7"
/>
<div class="v-data-footer">
<span>
{{ page }} of {{ total }}
</span>
<v-btn
text
:disabled="page===1"
fab
small
@click="prevPage"
>
<v-icon>mdi-chevron-left</v-icon>
</v-btn>
<v-btn
text
:disabled="page===total"
fab
small
@click="nextPage"
>
<v-icon>mdi-chevron-right</v-icon>
</v-btn>
</div>
</template> </template>
<script> <script>
@ -59,7 +77,13 @@ export default {
methods: { methods: {
...mapActions('documents', ['getDocumentList']), ...mapActions('documents', ['getDocumentList']),
...mapMutations('documents', ['setCurrent'])
...mapMutations('documents', ['setCurrent']),
prevPage() {
this.page -= 1
},
nextPage() {
this.page += 1
}
} }
} }
</script> </script>

3
frontend/pages/projects/_id/annotation/index.vue

@ -12,6 +12,8 @@
<v-card color="transparent elevation-0"> <v-card color="transparent elevation-0">
<v-card-title> <v-card-title>
<guideline-button /> <guideline-button />
<v-spacer />
<paginator />
</v-card-title> </v-card-title>
</v-card> </v-card>
<v-card> <v-card>
@ -19,7 +21,6 @@
<entity-item-box /> <entity-item-box />
</v-card-text> </v-card-text>
</v-card> </v-card>
<paginator class="mt-3" />
</v-flex> </v-flex>
</v-layout> </v-layout>
</v-container> </v-container>

Loading…
Cancel
Save