Source.vue 4.3 KB

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