Source.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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. export default {
  9. props: ['concernement', 'entite', "eid", 'source'],
  10. emits: ['reloadEntite'],
  11. data() {
  12. return {
  13. }
  14. },
  15. computed: {
  16. ...mapState(ConcernementsStore,['ct_entite']),
  17. field_sources_label () {
  18. let str;
  19. if (this.concernement.entites_byid[this.eid].menacemaintien < 0) {
  20. str = this.ct_entite.field_sources.description.replace('/ ce maintien', '')
  21. } else {
  22. str = this.ct_entite.field_sources.description.replace('cette menace /', '')
  23. }
  24. return str;
  25. }
  26. },
  27. methods: {
  28. reloadEntite(){
  29. this.$emit('reloadEntite');
  30. }
  31. },
  32. components: {
  33. ContentEditable,
  34. CheckboxEditable,
  35. ImageEditable,
  36. }
  37. }
  38. </script>
  39. <template>
  40. <section class="source">
  41. <!-- <div class="date">{{ source.date.start }}</div> -->
  42. <section v-if="source.description" class="description">
  43. <label v-if="ct_entite"> {{ field_sources_label }}</label>
  44. <div v-html="source.description"/>
  45. </section>
  46. <section
  47. v-if="source.images.length"
  48. class="images">
  49. <figure
  50. v-for="(image, j) in source.images"
  51. :key="j">
  52. <figure>
  53. <img :src="image.url" :alt="image.alt"/>
  54. <figcaption>{{ image.alt }}</figcaption>
  55. </figure>
  56. </figure>
  57. </section>
  58. <section
  59. v-if="source.videos.length"
  60. class="video multiple">
  61. <vue-plyr
  62. v-for="(video,v) in source.videos"
  63. :key="v">
  64. <div class="plyr__video-embed">
  65. <!-- TODO fix vimeo embed url -->
  66. <iframe
  67. :src="video.url"
  68. allowfullscreen
  69. ></iframe>
  70. </div>
  71. </vue-plyr>
  72. </section>
  73. <section
  74. v-if="source.audios.length"
  75. class="audio multiple">
  76. <div
  77. v-for="(audio,a) in source.audios"
  78. :key="a">
  79. <label v-if="audio.description">{{ audio.description }}</label>
  80. <label v-else>{{ audio.file.filename }}</label>
  81. <vue-plyr>
  82. <audio>
  83. <source :src="audio.file.url" :type="audio.file.filemime" />
  84. </audio>
  85. </vue-plyr>
  86. </div>
  87. </section>
  88. <section
  89. v-if="source.liens.length"
  90. class="liens multiple">
  91. <ul>
  92. <li
  93. v-for="(lien,l) in source.liens"
  94. :key="l">
  95. <a
  96. :href="lien.url">
  97. {{ lien.title }}
  98. </a>
  99. </li>
  100. </ul>
  101. </section>
  102. <section
  103. v-if="source.documents.length"
  104. class="documents multiple">
  105. <a
  106. v-for="(doc,d) in source.documents"
  107. :key="d"
  108. :href="doc.file.url">
  109. <template v-if="doc.description">{{ doc.description }}</template>
  110. <template v-else>{{ doc.file.url }}</template>
  111. </a>
  112. </section>
  113. </section>
  114. </template>
  115. <style lang="css">
  116. </style>