TextCard.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <template>
  2. <b-card no-body tag="article" class="text-card">
  3. <b-overlay class="h-100" :show="loading">
  4. <div v-if="text" class="container-fill">
  5. <b-card-header header-tag="header">
  6. <h4>
  7. <template v-if="text.type === 'Textref'">
  8. <span>{{ text.authors | list }},</span>
  9. <span>{{ text.title }},</span>
  10. <span>{{ text.edition }}</span>
  11. </template>
  12. <template v-else>
  13. {{ text.title }}
  14. </template>
  15. </h4>
  16. <b-nav class="ml-auto flex-nowrap">
  17. <b-nav-item v-for="prod in text.prods" :key="prod.id">
  18. {{ prod.id }}
  19. </b-nav-item>
  20. <b-nav-item>
  21. x
  22. </b-nav-item>
  23. </b-nav>
  24. </b-card-header>
  25. <b-card-body v-html="text.content" class="overflow-auto" />
  26. <b-card-footer>
  27. <b-badge
  28. v-for="tag in text.tags" :key="tag.id"
  29. variant="dark" pill
  30. >
  31. {{ tag.name }}
  32. </b-badge>
  33. <b-button
  34. v-if="text.bounces"
  35. :id="'bounces-' + text.id"
  36. >
  37. Textes rebonds
  38. </b-button>
  39. <b-popover
  40. v-if="text.bounces"
  41. :target="'bounces-' + text.id" triggers="click" placement="top"
  42. >
  43. <div v-for="bounce in text.bounces" :key="bounce.id">
  44. <h6>
  45. <span>{{ bounce.authors | list }},</span>
  46. <span>{{ bounce.title }},</span>
  47. <span>{{ bounce.edition }}</span>
  48. </h6>
  49. </div>
  50. </b-popover>
  51. </b-card-footer>
  52. </div>
  53. </b-overlay>
  54. </b-card>
  55. </template>
  56. <script>
  57. export default {
  58. name: 'TextCard',
  59. props: {
  60. id: { type: Number, required: true }
  61. },
  62. data () {
  63. return {
  64. loading: true,
  65. text: null
  66. }
  67. },
  68. filters: {
  69. list (arr) {
  70. return arr.map(({ name }) => name).join(', ')
  71. }
  72. },
  73. created () {
  74. this.$store.dispatch('GET_TEXT', { id: this.id }).then((text) => {
  75. this.text = text
  76. this.loading = false
  77. })
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. article {
  83. height: 100%;
  84. // max-height: 100%;
  85. }
  86. header {
  87. display: flex;
  88. h4 {
  89. display: flex;
  90. flex-direction: column;
  91. }
  92. }
  93. </style>