logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

attachment_setting.vue (2714B)


  1. <template>
  2. <span
  3. v-if="matchesExpertLevel"
  4. class="AttachmentSetting"
  5. :class="{ '-compact': compact }"
  6. >
  7. <label
  8. :for="path"
  9. :class="{ 'faint': shouldBeDisabled }"
  10. >
  11. <template v-if="backendDescriptionLabel">
  12. {{ backendDescriptionLabel + ' ' }}
  13. </template>
  14. <template v-else-if="source === 'admin'">
  15. MISSING LABEL FOR {{ path }}
  16. </template>
  17. <slot v-else />
  18. </label>
  19. <p
  20. v-if="backendDescriptionDescription"
  21. class="setting-description"
  22. :class="{ 'faint': shouldBeDisabled }"
  23. >
  24. {{ backendDescriptionDescription + ' ' }}
  25. </p>
  26. <div class="attachment-input">
  27. <div class="controls control-field">
  28. <label for="path">{{ $t('settings.url') }}</label>
  29. <input
  30. :id="path"
  31. class="input string-input"
  32. :disabled="shouldBeDisabled"
  33. :value="realDraftMode ? draft : state"
  34. @change="update"
  35. >
  36. {{ ' ' }}
  37. <ModifiedIndicator
  38. :changed="isChanged"
  39. :onclick="reset"
  40. />
  41. <ProfileSettingIndicator :is-profile="isProfileSetting" />
  42. </div>
  43. <div v-if="!compact">{{ $t('settings.preview') }}</div>
  44. <Attachment
  45. class="attachment"
  46. :compact="compact"
  47. :attachment="attachment"
  48. size="small"
  49. hide-description
  50. @setMedia="onMedia"
  51. @naturalSizeLoad="onNaturalSizeLoad"
  52. />
  53. <div class="controls control-upload">
  54. <MediaUpload
  55. ref="mediaUpload"
  56. class="media-upload-icon"
  57. :drop-files="dropFiles"
  58. normal-button
  59. :accept-types="acceptTypes"
  60. @uploaded="setMediaFile"
  61. @upload-failed="uploadFailed"
  62. />
  63. </div>
  64. </div>
  65. <DraftButtons />
  66. </span>
  67. </template>
  68. <script src="./attachment_setting.js"></script>
  69. <style lang="scss">
  70. .AttachmentSetting {
  71. .attachment {
  72. display: block;
  73. width: 100%;
  74. height: 15em;
  75. margin-bottom: 0.5em;
  76. }
  77. .attachment-input {
  78. margin-left: 1em;
  79. display: flex;
  80. flex-direction: column;
  81. width: 20em;
  82. }
  83. &.-compact {
  84. .attachment-input {
  85. flex-direction: row;
  86. align-items: flex-end;
  87. }
  88. .attachment {
  89. flex: 0;
  90. order: 0;
  91. display: block;
  92. min-width: 4em;
  93. height: 4em;
  94. align-self: center;
  95. margin-bottom: 0;
  96. }
  97. .control-field {
  98. order: 1;
  99. min-width: 12em;
  100. margin-left: 0.5em;
  101. }
  102. .control-upload {
  103. order: 2;
  104. min-width: 12em;
  105. padding: 0 0.5em;
  106. }
  107. }
  108. .controls {
  109. margin-bottom: 0.5em;
  110. input,
  111. button {
  112. width: 100%;
  113. }
  114. }
  115. }
  116. </style>