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 (5458B)


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