Table.vue 2.85 KB
Newer Older
1
<template>
2
  <table class="ui compact very basic fixed single line unstackable table">
3
4
5
6
    <thead>
      <tr>
        <th></th>
        <th></th>
Bat's avatar
Bat committed
7
8
9
        <i18next tag="th" colspan="6" path="Title"/>
        <i18next tag="th" colspan="6" path="Artist"/>
        <i18next tag="th" colspan="6" path="Album"/>
10
11
12
13
        <th></th>
      </tr>
    </thead>
    <tbody>
14
15
16
17
18
      <track-row
        :display-position="displayPosition"
        :track="track"
        :key="index + '-' + track.id"
        v-for="(track, index) in tracks"></track-row>
19
    </tbody>
20
21
22
    <tfoot class="full-width">
      <tr>
        <th colspan="3">
Bat's avatar
Bat committed
23
24
25
          <button @click="showDownloadModal = !showDownloadModal" class="ui basic button">
            <i18next path="Download..."/>
          </button>
26
          <modal :show.sync="showDownloadModal">
Bat's avatar
Bat committed
27
            <i18next tag="div" path="Download tracks" class="header" />
28
29
            <div class="content">
              <div class="description">
Bat's avatar
Bat committed
30
31
32
33
34
                <i18next tag="p" path="There is currently no way to download directly multiple tracks from funkwhale as a ZIP archive. However, you can use a command line tools such as {%0%} to easily download a list of tracks.">
                  <a href="https://curl.haxx.se/" target="_blank">cURL</a>
                </i18next>
                <i18next path="Simply copy paste the snippet below into a terminal to launch the download."/>
                <i18next tag="div" class="ui warning message" path="Keep your PRIVATE_TOKEN secret as it gives access to your account."/>
35
                <pre>
36
export PRIVATE_TOKEN="{{ $store.state.auth.token }}"
37
<template v-for="track in tracks"><template v-if="track.files.length > 0">
38
curl -G -o "{{ track.files[0].filename }}" <template v-if="$store.state.auth.authenticated">--header "Authorization: JWT $PRIVATE_TOKEN"</template> "{{ backend.absoluteUrl(track.files[0].path) }}"</template></template>
39
40
41
42
</pre>
              </div>
            </div>
            <div class="actions">
Bat's avatar
Bat committed
43
              <i18next tag="div" class="ui black deny button" path="Cancel" />
44
45
46
47
48
49
50
51
52
53
            </div>
          </modal>
        </th>
        <th></th>
        <th colspan="4"></th>
        <th colspan="6"></th>
        <th colspan="6"></th>
        <th></th>
      </tr>
    </tfoot>
54
55
56
57
58
59
  </table>
</template>

<script>
import backend from '@/audio/backend'

60
import TrackRow from '@/components/audio/track/Row'
61
62
import Modal from '@/components/semantic/Modal'

63
export default {
64
65
66
67
  props: {
    tracks: {type: Array, required: true},
    displayPosition: {type: Boolean, default: false}
  },
68
  components: {
69
    Modal,
70
    TrackRow
71
72
73
  },
  data () {
    return {
74
75
      backend: backend,
      showDownloadModal: false
76
77
78
79
80
81
82
83
84
85
86
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

tr:not(:hover) .favorite-icon:not(.favorited) {
  display: none;
}
87
88
89
pre {
  overflow-x: scroll;
}
90
</style>