logo

pleroma-fe

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

emoji_tab.vue (11897B)


  1. <template>
  2. <div
  3. class="emoji-tab"
  4. :label="$t('admin_dash.tabs.emoji')"
  5. >
  6. <div class="setting-item">
  7. <h2>{{ $t('admin_dash.tabs.emoji') }}</h2>
  8. <ul class="setting-list">
  9. <h3>{{ $t('admin_dash.emoji.global_actions') }}</h3>
  10. <li class="btn-group setting-item">
  11. <button
  12. class="button button-default btn"
  13. type="button"
  14. @click="reloadEmoji"
  15. >
  16. {{ $t('admin_dash.emoji.reload') }}
  17. </button>
  18. <button
  19. class="button button-default btn"
  20. type="button"
  21. @click="importFromFS"
  22. >
  23. {{ $t('admin_dash.emoji.importFS') }}
  24. </button>
  25. </li>
  26. <li class="btn-group setting-item">
  27. <button
  28. class="button button-default btn"
  29. type="button"
  30. @click="$refs.remotePackPopover.showPopover"
  31. >
  32. {{ $t('admin_dash.emoji.remote_packs') }}
  33. <Popover
  34. ref="remotePackPopover"
  35. popover-class="emoji-tab-edit-popover popover-default"
  36. trigger="click"
  37. placement="bottom"
  38. bound-to-selector=".emoji-tab"
  39. :bound-to="{ x: 'container' }"
  40. :offset="{ y: 5 }"
  41. >
  42. <template #content>
  43. <div class="emoji-tab-popover-input">
  44. <h3>{{ $t('admin_dash.emoji.remote_pack_instance') }}</h3>
  45. <input
  46. v-model="remotePackInstance"
  47. class="input"
  48. :placeholder="$t('admin_dash.emoji.remote_pack_instance')"
  49. >
  50. <button
  51. class="button button-default btn emoji-tab-popover-button"
  52. type="button"
  53. @click="listRemotePacks"
  54. >
  55. {{ $t('admin_dash.emoji.do_list') }}
  56. </button>
  57. </div>
  58. </template>
  59. </Popover>
  60. </button>
  61. </li>
  62. <h3>{{ $t('admin_dash.emoji.emoji_packs') }}</h3>
  63. <li>
  64. <h4>{{ $t('admin_dash.emoji.edit_pack') }}</h4>
  65. <Select
  66. v-model="packName"
  67. class="form-control"
  68. >
  69. <option
  70. value=""
  71. disabled
  72. hidden
  73. >
  74. {{ $t('admin_dash.emoji.emoji_pack') }}
  75. </option>
  76. <option
  77. v-for="(pack, listPackName) in knownPacks"
  78. :key="listPackName"
  79. :label="listPackName"
  80. >
  81. {{ listPackName }}
  82. </option>
  83. </Select>
  84. <button
  85. class="button button-default btn emoji-tab-popover-button"
  86. type="button"
  87. @click="$refs.createPackPopover.showPopover"
  88. >
  89. {{ $t('admin_dash.emoji.create_pack') }}
  90. </button>
  91. <Popover
  92. ref="createPackPopover"
  93. popover-class="emoji-tab-edit-popover popover-default"
  94. trigger="click"
  95. placement="bottom"
  96. bound-to-selector=".emoji-tab"
  97. :bound-to="{ x: 'container' }"
  98. :offset="{ y: 5 }"
  99. >
  100. <template #content>
  101. <div class="emoji-tab-popover-input">
  102. <h3>{{ $t('admin_dash.emoji.new_pack_name') }}</h3>
  103. <input
  104. v-model="newPackName"
  105. :placeholder="$t('admin_dash.emoji.new_pack_name')"
  106. class="input"
  107. >
  108. <button
  109. class="button button-default btn emoji-tab-popover-button"
  110. type="button"
  111. @click="createEmojiPack"
  112. >
  113. {{ $t('admin_dash.emoji.create') }}
  114. </button>
  115. </div>
  116. </template>
  117. </Popover>
  118. </li>
  119. </ul>
  120. <div v-if="pack">
  121. <div class="pack-info-wrapper">
  122. <ul class="setting-list">
  123. <li>
  124. <label>
  125. {{ $t('admin_dash.emoji.description') }}
  126. <ModifiedIndicator
  127. :changed="metaEdited('description')"
  128. message-key="admin_dash.emoji.metadata_changed"
  129. />
  130. <textarea
  131. v-model="packMeta.description"
  132. :disabled="pack.remote !== undefined"
  133. class="bio resize-height input"
  134. />
  135. </label>
  136. </li>
  137. <li>
  138. <label>
  139. {{ $t('admin_dash.emoji.homepage') }}
  140. <ModifiedIndicator
  141. :changed="metaEdited('homepage')"
  142. message-key="admin_dash.emoji.metadata_changed"
  143. />
  144. <input
  145. v-model="packMeta.homepage"
  146. class="emoji-info-input input"
  147. :disabled="pack.remote !== undefined"
  148. >
  149. </label>
  150. </li>
  151. <li>
  152. <label>
  153. {{ $t('admin_dash.emoji.fallback_src') }}
  154. <ModifiedIndicator
  155. :changed="metaEdited('fallback-src')"
  156. message-key="admin_dash.emoji.metadata_changed"
  157. />
  158. <input
  159. v-model="packMeta['fallback-src']"
  160. class="emoji-info-input input"
  161. :disabled="pack.remote !== undefined"
  162. >
  163. </label>
  164. </li>
  165. <li>
  166. <label>
  167. {{ $t('admin_dash.emoji.fallback_sha256') }}
  168. <input
  169. v-model="packMeta['fallback-src-sha256']"
  170. :disabled="true"
  171. class="emoji-info-input input"
  172. >
  173. </label>
  174. </li>
  175. <li>
  176. <Checkbox
  177. v-model="packMeta['share-files']"
  178. :disabled="pack.remote !== undefined"
  179. >
  180. {{ $t('admin_dash.emoji.share') }}
  181. </Checkbox>
  182. <ModifiedIndicator
  183. :changed="metaEdited('share-files')"
  184. message-key="admin_dash.emoji.metadata_changed"
  185. />
  186. </li>
  187. <li class="btn-group">
  188. <button
  189. v-if="pack.remote === undefined"
  190. class="button button-default btn"
  191. type="button"
  192. @click="savePackMetadata"
  193. >
  194. {{ $t('admin_dash.emoji.save_meta') }}
  195. </button>
  196. <button
  197. v-if="pack.remote === undefined"
  198. class="button button-default btn"
  199. type="button"
  200. @click="savePackMetadata"
  201. >
  202. {{ $t('admin_dash.emoji.revert_meta') }}
  203. </button>
  204. <button
  205. v-if="pack.remote === undefined"
  206. class="button button-default btn"
  207. type="button"
  208. @click="deleteModalVisible = true"
  209. >
  210. {{ $t('admin_dash.emoji.delete_pack') }}
  211. <ConfirmModal
  212. v-if="deleteModalVisible"
  213. :title="$t('admin_dash.emoji.delete_title')"
  214. :cancel-text="$t('status.delete_confirm_cancel_button')"
  215. :confirm-text="$t('status.delete_confirm_accept_button')"
  216. @cancelled="deleteModalVisible = false"
  217. @accepted="deleteEmojiPack"
  218. >
  219. {{ $t('admin_dash.emoji.delete_confirm', [packName]) }}
  220. </ConfirmModal>
  221. </button>
  222. <button
  223. v-if="pack.remote !== undefined"
  224. class="button button-default btn"
  225. type="button"
  226. @click="$refs.dlPackPopover.showPopover"
  227. >
  228. {{ $t('admin_dash.emoji.download_pack') }}
  229. <Popover
  230. ref="dlPackPopover"
  231. trigger="click"
  232. placement="bottom"
  233. bound-to-selector=".emoji-tab"
  234. popover-class="emoji-tab-edit-popover popover-default"
  235. :bound-to="{ x: 'container' }"
  236. :offset="{ y: 5 }"
  237. >
  238. <template #content>
  239. <h3>{{ $t('admin_dash.emoji.downloading_pack', [packName]) }}</h3>
  240. <div>
  241. <div>
  242. <div class="emoji-tab-popover-input">
  243. <label>
  244. {{ $t('admin_dash.emoji.download_as_name') }}
  245. <input
  246. v-model="remotePackDownloadAs"
  247. class="emoji-data-input input"
  248. :placeholder="$t('admin_dash.emoji.download_as_name_full')"
  249. >
  250. </label>
  251. <div
  252. v-if="downloadWillReplaceLocal"
  253. class="warning"
  254. >
  255. <em>{{ $t('admin_dash.emoji.replace_warning') }}</em>
  256. </div>
  257. </div>
  258. <button
  259. class="button button-default btn"
  260. type="button"
  261. @click="downloadRemotePack"
  262. >
  263. {{ $t('admin_dash.emoji.download') }}
  264. </button>
  265. </div>
  266. </div>
  267. </template>
  268. </Popover>
  269. </button>
  270. </li>
  271. </ul>
  272. </div>
  273. <ul class="setting-list">
  274. <h4>
  275. {{ $t('admin_dash.emoji.files') }}
  276. <ModifiedIndicator
  277. v-if="pack"
  278. :changed="$refs.emojiPopovers && $refs.emojiPopovers.some(p => p.isEdited)"
  279. message-key="admin_dash.emoji.emoji_changed"
  280. />
  281. </h4>
  282. <div
  283. v-if="pack"
  284. class="emoji-list"
  285. >
  286. <EmojiEditingPopover
  287. v-if="pack.remote === undefined"
  288. placement="bottom"
  289. new-upload
  290. :title="$t('admin_dash.emoji.adding_new')"
  291. :pack-name="packName"
  292. @updatePackFiles="updatePackFiles"
  293. @displayError="displayError"
  294. >
  295. <template #trigger>
  296. <FAIcon
  297. icon="plus"
  298. size="2x"
  299. :title="$t('admin_dash.emoji.add_file')"
  300. />
  301. </template>
  302. </EmojiEditingPopover>
  303. <EmojiEditingPopover
  304. v-for="(file, shortcode) in pack.files"
  305. ref="emojiPopovers"
  306. :key="shortcode"
  307. placement="top"
  308. :title="$t('admin_dash.emoji.editing', [shortcode])"
  309. :disabled="pack.remote !== undefined"
  310. :shortcode="shortcode"
  311. :file="file"
  312. :pack-name="packName"
  313. @updatePackFiles="updatePackFiles"
  314. @displayError="displayError"
  315. >
  316. <template #trigger>
  317. <StillImage
  318. class="emoji"
  319. :src="emojiAddr(file)"
  320. :title="`:${shortcode}:`"
  321. :alt="`:${shortcode}:`"
  322. />
  323. </template>
  324. </EmojiEditingPopover>
  325. </div>
  326. </ul>
  327. </div>
  328. </div>
  329. </div>
  330. </template>
  331. <script src="./emoji_tab.js"></script>
  332. <style lang="scss" src="./emoji_tab.scss"></style>