aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/helpers/attachment_setting.vue
blob: 3a93351154b0f9bbaa889601d811b999fd9ea252 (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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<template>
  <span
    v-if="matchesExpertLevel"
    class="AttachmentSetting"
  >
    <label :for="path" :class="{ 'faint': shouldBeDisabled }">
      <template v-if="backendDescriptionLabel">
        {{ backendDescriptionLabel + ' ' }}
      </template>
      <template v-else>
        <slot />
      </template>

    </label>
    <p
      v-if="backendDescriptionDescription"
      class="setting-description"
      :class="{ 'faint': shouldBeDisabled }"
    >
      {{ backendDescriptionDescription + ' ' }}
    </p>
    <div class="attachment-input">
      <Attachment
        class="attachment"
        :compact="compact"
        :attachment="attachment"
        size="small"
        hide-description
        @setMedia="onMedia"
        @naturalSizeLoad="onNaturalSizeLoad"
      />
      <div class="controls">
        <media-upload
          normal-button
          ref="mediaUpload"
          class="media-upload-icon"
          :drop-files="dropFiles"
          @uploaded="setMediaFile"
          @upload-failed="uploadFailed"
        />
        <input
          :id="path"
          class="string-input"
          :disabled="shouldBeDisabled"
          :value="realDraftMode ? draft : state"
          @change="update"
        >
        {{ ' ' }}
        <ModifiedIndicator
          :changed="isChanged"
          :onclick="reset"
        />
        <ProfileSettingIndicator :is-profile="isProfileSetting" />
      </div>
    </div>
    <DraftButtons />
  </span>
</template>

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

<style lang="scss">
.AttachmentSetting {
  .attachment {
    display: block;
    width: 20em;
    height: 15em;
  }
}
</style>