Source.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. <script>
  2. import { mapActions, mapState } from 'pinia'
  3. import { ConcernementsStore } from '@stores/concernements'
  4. import { UserStore } from '@stores/user'
  5. import ContentEditable from '@components/editable/ContentEditable.vue';
  6. import CheckboxEditable from '@components/editable/CheckboxEditable.vue';
  7. import ImageEditable from '@components/editable/ImageEditable.vue';
  8. import VideoEditable from '@components/editable/VideoEditable.vue';
  9. import AudioEditable from '@components/editable/AudioEditable.vue';
  10. import LinkEditable from '@components/editable/LinkEditable.vue';
  11. import FileEditable from '@components/editable/FileEditable.vue';
  12. export default {
  13. props: ['concernement', 'entite', "eid", 'source'],
  14. emits: ['reloadEntite'],
  15. data() {
  16. return {
  17. // plyr_options: {
  18. // controls: ['play', 'progress', 'current-time', 'mute', 'volume']
  19. // }
  20. }
  21. },
  22. computed: {
  23. ...mapState(ConcernementsStore,['ct_entite']),
  24. field_sources_label () {
  25. let str;
  26. if (this.concernement.entites_byid[this.eid].menacemaintien < 0) {
  27. str = this.ct_entite.field_sources.description.replace('/ ce maintien', '')
  28. } else {
  29. str = this.ct_entite.field_sources.description.replace('cette menace /', '')
  30. }
  31. return str;
  32. }
  33. },
  34. methods: {
  35. reloadEntite(){
  36. this.$emit('reloadEntite');
  37. }
  38. },
  39. components: {
  40. ContentEditable,
  41. CheckboxEditable,
  42. ImageEditable,
  43. VideoEditable,
  44. AudioEditable,
  45. LinkEditable,
  46. FileEditable
  47. }
  48. }
  49. </script>
  50. <template>
  51. <section class="source">
  52. <!-- <div class="date">{{ source.date.start }}</div> -->
  53. <section v-if="source.description" class="description">
  54. <label v-if="ct_entite"> {{ field_sources_label }}</label>
  55. <!-- <div v-html="source.description"/> -->
  56. <ContentEditable
  57. tag="div"
  58. :value="source.description"
  59. :contenteditable="entite.can_update"
  60. :html="true"
  61. :data="{
  62. entitytype: 'paragraph',
  63. bundle: 'source',
  64. id: this.source.id,
  65. field: {field_name: 'field_description', value:'value'}
  66. }"
  67. v-on:updated="reloadEntite" />
  68. </section>
  69. <!-- v-if="source.images.length"
  70. :key="j"
  71. -->
  72. <section
  73. class="images">
  74. <ImageEditable
  75. :can_update="entite.can_update"
  76. :image="source.images[0]"
  77. :data="{
  78. entitytype: 'paragraph',
  79. bundle: 'source',
  80. id: this.source.id,
  81. uuid: this.source.uuid,
  82. field: 'field_images'
  83. }"
  84. v-on:updated="reloadEntite" />
  85. </section>
  86. <!-- v-if="source.videos.length" -->
  87. <section
  88. class="video">
  89. <VideoEditable
  90. :can_update="entite.can_update"
  91. :video="source.videos[0]"
  92. :data="{
  93. entitytype: 'paragraph',
  94. bundle: 'source',
  95. id: this.source.id,
  96. uuid: this.source.uuid,
  97. field: {
  98. field_name: 'field_videos',
  99. value: 'value'
  100. }
  101. }"
  102. v-on:updated="reloadEntite"/>
  103. </section>
  104. <!-- v-if="source.audios.length" -->
  105. <section
  106. class="audio">
  107. <AudioEditable
  108. :can_update="entite.can_update"
  109. :audio="source.audios[0]"
  110. :data="{
  111. entitytype: 'paragraph',
  112. bundle: 'source',
  113. id: this.source.id,
  114. uuid: this.source.uuid,
  115. field: {
  116. field_name: 'field_audio',
  117. value: 'value'
  118. }
  119. }"
  120. v-on:updated="reloadEntite"/>
  121. </section>
  122. <!-- v-if="source.liens.length" -->
  123. <section class="liens multiple">
  124. <LinkEditable
  125. :can_update="entite.can_update"
  126. :links="source.liens"
  127. :data="{
  128. entitytype: 'paragraph',
  129. bundle: 'source',
  130. id: this.source.id,
  131. uuid: this.source.uuid,
  132. field: {
  133. field_name: 'field_liens'
  134. }
  135. }"
  136. label="Liens"
  137. v-on:updated="reloadEntite "/>
  138. </section>
  139. <!-- v-if="source.documents.length" -->
  140. <section class="documents multiple">
  141. <!-- <a
  142. v-for="(doc,d) in source.documents"
  143. :key="d"
  144. :href="doc.file.url">
  145. <template v-if="doc.description">{{ doc.description }}</template>
  146. <template v-else>{{ doc.file.url }}</template>
  147. </a> -->
  148. <FileEditable
  149. :can_update="entite.can_update"
  150. :files="source.documents"
  151. :data="{
  152. entitytype: 'paragraph',
  153. bundle: 'source',
  154. id: this.source.id,
  155. uuid: this.source.uuid,
  156. field: {
  157. field_name: 'field_documents'
  158. }
  159. }"
  160. label="Documents"
  161. v-on:updated="reloadEntite "/>
  162. </section>
  163. </section>
  164. </template>
  165. <style lang="css">
  166. </style>