Source.vue 4.1 KB

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