Upload.vue 1.06 KB
Newer Older
1
2
3
<template>
  <div class="ui vertical aligned stripe segment">
    <div v-if="isLoadingLibrary" :class="['ui', {'active': isLoadingLibrary}, 'inverted', 'dimmer']">
Allan Nordhøy's avatar
Allan Nordhøy committed
4
      <div class="ui text loader"><translate>Loading library data…</translate></div>
5
6
    </div>
    <detail-area v-else :library="library">
7
      <file-upload ref="fileupload" :default-import-reference="defaultImportReference" :library="library" />
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
    </detail-area>
  </div>
</template>

<script>
import DetailMixin from './DetailMixin'
import DetailArea from './DetailArea'

import FileUpload from '@/components/library/FileUpload'
export default {
  mixins: [DetailMixin],
  props: ['defaultImportReference'],
  components: {
    DetailArea,
    FileUpload
23
24
25
26
27
28
29
30
31
32
33
34
35
  },
  beforeRouteLeave (to, from, next){
    if (this.$refs.fileupload.hasActiveUploads){
      const answer = window.confirm('This page is asking you to confirm that you want to leave - data you have entered may not be saved.')
      if (answer) {
        next()
      } else {
        next(false)
      }
    }
    else{
      next()
    }
36
37
38
  }
}
</script>