aboutsummaryrefslogtreecommitdiff
path: root/src/components/media_upload/media_upload.vue
blob: 2ea5567a25927ab662ca4627f8378382f3412096 (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
<template>
  <button
    class="media-upload"
    :class="[normalButton ? 'button-default btn' : 'button-unstyled', { disabled }]"
    :title="$t('tool_tip.media_upload')"
    @click="onClick"
  >
    <FAIcon
      v-if="uploading"
      class="progress-icon"
      icon="circle-notch"
      spin
    />
    <FAIcon
      v-if="!uploading"
      class="new-icon"
      icon="upload"
    />
    <template v-if="normalButton">
      {{ ' ' }}
      {{ uploading ? $t('general.loading') : $t('tool_tip.media_upload') }}
    </template>
    <input
      v-if="uploadReady"
      ref="input"
      class="hidden-input-file"
      :disabled="disabled"
      type="file"
      multiple="true"
      :accept="acceptTypes"
      @change="change"
    >
  </button>
</template>

<script src="./media_upload.js"></script>

<style lang="scss">
@import "../../variables";

.media-upload {
  .hidden-input-file {
    display: none;
  }
}

label.media-upload {
  cursor: pointer; // We use <label> for interactivity... i wonder if it's fine
}
</style>