Source.vue 4.5 KB

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