Welcome to mirror list, hosted at ThFree Co, Russian Federation.

download_viewer.vue « blob_viewers « components « repository « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 48fa33eb55889d5e9fc8a44602629370cb85324e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<script>
import { GlIcon, GlLink } from '@gitlab/ui';
import { numberToHumanSize } from '~/lib/utils/number_utils';
import { sprintf, __ } from '~/locale';

export default {
  components: {
    GlIcon,
    GlLink,
  },
  props: {
    fileName: {
      type: String,
      required: true,
    },
    filePath: {
      type: String,
      required: true,
    },
    fileSize: {
      type: Number,
      required: false,
      default: 0,
    },
  },
  computed: {
    downloadFileSize() {
      return numberToHumanSize(this.fileSize);
    },
    downloadText() {
      if (this.fileSize > 0) {
        return sprintf(__('Download (%{fileSizeReadable})'), {
          fileSizeReadable: this.downloadFileSize,
        });
      }
      return __('Download');
    },
  },
};
</script>

<template>
  <div class="gl-text-center gl-py-13 gl-bg-gray-50">
    <gl-link :href="filePath" rel="nofollow" :download="fileName" target="_blank">
      <div>
        <gl-icon :size="16" name="download" class="gl-text-gray-900" />
      </div>
      <h4>{{ downloadText }}</h4>
    </gl-link>
  </div>
</template>