logo

pleroma-fe

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

lists_edit.vue (5408B)


  1. <template>
  2. <div class="panel-default panel ListEdit">
  3. <div
  4. ref="header"
  5. class="panel-heading list-edit-heading"
  6. >
  7. <button
  8. class="button-unstyled go-back-button"
  9. @click="$router.back"
  10. >
  11. <FAIcon
  12. size="lg"
  13. icon="chevron-left"
  14. />
  15. </button>
  16. <div class="title">
  17. <i18n-t
  18. v-if="id"
  19. keypath="lists.editing_list"
  20. >
  21. <template #listTitle>
  22. {{ title }}
  23. </template>
  24. </i18n-t>
  25. <i18n-t
  26. v-else
  27. keypath="lists.creating_list"
  28. />
  29. </div>
  30. </div>
  31. <div class="panel-body">
  32. <div class="input-wrap">
  33. <label for="list-edit-title">{{ $t('lists.title') }}</label>
  34. {{ ' ' }}
  35. <input
  36. id="list-edit-title"
  37. ref="title"
  38. v-model="titleDraft"
  39. class="input"
  40. >
  41. <button
  42. v-if="id"
  43. class="btn button-default follow-button"
  44. @click="updateListTitle"
  45. >
  46. {{ $t('lists.update_title') }}
  47. </button>
  48. </div>
  49. <tab-switcher
  50. class="list-member-management"
  51. :scrollable-tabs="true"
  52. >
  53. <div
  54. v-if="id || addedUserIds.size > 0"
  55. :label="$t('lists.manage_members')"
  56. class="members-list"
  57. >
  58. <div class="users-list">
  59. <div
  60. v-for="user in membersUsers"
  61. :key="user.id"
  62. class="member"
  63. >
  64. <BasicUserCard
  65. :user="user"
  66. >
  67. <button
  68. class="btn button-default follow-button"
  69. @click="toggleRemoveMember(user)"
  70. >
  71. {{ isRemoved(user) ? $t('general.undo') : $t('lists.remove_from_list') }}
  72. </button>
  73. </BasicUserCard>
  74. </div>
  75. </div>
  76. </div>
  77. <div
  78. class="search-list"
  79. :label="$t('lists.add_members')"
  80. >
  81. <ListsUserSearch
  82. @results="onSearchResults"
  83. @loading="onSearchLoading"
  84. @loadingDone="onSearchLoadingDone"
  85. />
  86. <div
  87. v-if="searchLoading"
  88. class="loading"
  89. >
  90. <PanelLoading />
  91. </div>
  92. <div
  93. v-else
  94. class="users-list"
  95. >
  96. <div
  97. v-for="user in searchUsers"
  98. :key="user.id"
  99. class="member"
  100. >
  101. <BasicUserCard
  102. :user="user"
  103. >
  104. <span
  105. v-if="membersUserIds.includes(user.id)"
  106. >
  107. {{ $t('lists.is_in_list') }}
  108. </span>
  109. <button
  110. v-if="!membersUserIds.includes(user.id)"
  111. class="btn button-default follow-button"
  112. @click="toggleAddFromSearch(user)"
  113. >
  114. {{ isAdded(user) ? $t('general.undo') : $t('lists.add_to_list') }}
  115. </button>
  116. <button
  117. v-else
  118. class="btn button-default follow-button"
  119. @click="toggleRemoveMember(user)"
  120. >
  121. {{ isRemoved(user) ? $t('general.undo') : $t('lists.remove_from_list') }}
  122. </button>
  123. </BasicUserCard>
  124. </div>
  125. </div>
  126. </div>
  127. </tab-switcher>
  128. </div>
  129. <div class="panel-footer">
  130. <span class="spacer" />
  131. <button
  132. v-if="!id"
  133. class="btn button-default footer-button"
  134. @click="createList"
  135. >
  136. {{ $t('lists.create') }}
  137. </button>
  138. <button
  139. v-else-if="!reallyDelete"
  140. class="btn button-default footer-button"
  141. @click="reallyDelete = true"
  142. >
  143. {{ $t('lists.delete') }}
  144. </button>
  145. <template v-else>
  146. {{ $t('lists.really_delete') }}
  147. <button
  148. class="btn button-default footer-button"
  149. @click="deleteList"
  150. >
  151. {{ $t('general.yes') }}
  152. </button>
  153. <button
  154. class="btn button-default footer-button"
  155. @click="reallyDelete = false"
  156. >
  157. {{ $t('general.no') }}
  158. </button>
  159. </template>
  160. </div>
  161. </div>
  162. </template>
  163. <script src="./lists_edit.js"></script>
  164. <style lang="scss">
  165. .ListEdit {
  166. --panel-body-padding: 0.5em;
  167. height: calc(100vh - var(--navbar-height));
  168. overflow: hidden;
  169. display: flex;
  170. flex-direction: column;
  171. .list-edit-heading {
  172. grid-template-columns: auto minmax(50%, 1fr);
  173. }
  174. .panel-body {
  175. display: flex;
  176. flex: 1;
  177. flex-direction: column;
  178. overflow: hidden;
  179. }
  180. .list-member-management {
  181. flex: 1 0 auto;
  182. }
  183. .search-icon {
  184. margin-right: 0.3em;
  185. }
  186. .users-list {
  187. padding-bottom: 0.7rem;
  188. overflow-y: auto;
  189. }
  190. & .search-list,
  191. & .members-list {
  192. overflow: hidden;
  193. flex-direction: column;
  194. min-height: 0;
  195. }
  196. .go-back-button {
  197. text-align: center;
  198. line-height: 1;
  199. height: 100%;
  200. align-self: start;
  201. width: var(--__panel-heading-height-inner);
  202. }
  203. .btn {
  204. margin: 0 0.5em;
  205. }
  206. .panel-footer {
  207. grid-template-columns: minmax(10%, 1fr);
  208. .footer-button {
  209. min-width: 9em;
  210. }
  211. }
  212. }
  213. </style>