aboutsummaryrefslogtreecommitdiff
path: root/src/components/settings_modal/helpers/attachment_setting.vue
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-06-05 21:53:14 +0300
committerHenry Jameson <me@hjkos.com>2023-06-05 21:53:14 +0300
commit5e656cc0b40a26435556fff79636c0b2e9c8af4f (patch)
tree8efc5369ac64d471b4d61f731bd99653f7e1e19d /src/components/settings_modal/helpers/attachment_setting.vue
parent00b47e16736f8b472f20dab8def30fb22d54c8be (diff)
parentae5181d21eefecc0167e2a076e6c8ad44f3ca859 (diff)
Merge remote-tracking branch 'origin/develop' into harden-parser
Diffstat (limited to 'src/components/settings_modal/helpers/attachment_setting.vue')
-rw-r--r--src/components/settings_modal/helpers/attachment_setting.vue96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/components/settings_modal/helpers/attachment_setting.vue b/src/components/settings_modal/helpers/attachment_setting.vue
new file mode 100644
index 00000000..bbc5172c
--- /dev/null
+++ b/src/components/settings_modal/helpers/attachment_setting.vue
@@ -0,0 +1,96 @@
+<template>
+ <span
+ v-if="matchesExpertLevel"
+ class="AttachmentSetting"
+ >
+ <label
+ :for="path"
+ :class="{ 'faint': shouldBeDisabled }"
+ >
+ <template v-if="backendDescriptionLabel">
+ {{ backendDescriptionLabel + ' ' }}
+ </template>
+ <template v-else-if="source === 'admin'">
+ MISSING LABEL FOR {{ path }}
+ </template>
+ <slot v-else />
+
+ </label>
+ <p
+ v-if="backendDescriptionDescription"
+ class="setting-description"
+ :class="{ 'faint': shouldBeDisabled }"
+ >
+ {{ backendDescriptionDescription + ' ' }}
+ </p>
+ <div class="attachment-input">
+ <div>{{ $t('settings.url') }}</div>
+ <div class="controls">
+ <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>{{ $t('settings.preview') }}</div>
+ <Attachment
+ class="attachment"
+ :compact="compact"
+ :attachment="attachment"
+ size="small"
+ hide-description
+ @setMedia="onMedia"
+ @naturalSizeLoad="onNaturalSizeLoad"
+ />
+ <div class="controls">
+ <MediaUpload
+ ref="mediaUpload"
+ class="media-upload-icon"
+ :drop-files="dropFiles"
+ normal-button
+ :accept-types="acceptTypes"
+ @uploaded="setMediaFile"
+ @upload-failed="uploadFailed"
+ />
+ </div>
+ </div>
+ <DraftButtons />
+ </span>
+</template>
+
+<script src="./attachment_setting.js"></script>
+
+<style lang="scss">
+.AttachmentSetting {
+ .attachment {
+ display: block;
+ width: 100%;
+ height: 15em;
+ margin-bottom: 0.5em;
+ }
+
+ .attachment-input {
+ margin-left: 1em;
+ display: flex;
+ flex-direction: column;
+ width: 20em;
+ }
+
+ .controls {
+ margin-bottom: 0.5em;
+
+ input,
+ button {
+ width: 100%;
+ }
+ }
+}
+</style>