ListCorpus.vue 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <template>
  2. <MainContentLayout id="list-corpus">
  3. <template v-slot:header>
  4. <h1>Corpus</h1>
  5. <span v-if="!editionslist.length" class="loading">Loading ...</span>
  6. </template>
  7. <ul v-if="editionslist.length" class="item-list">
  8. <li v-for="(corpus,index) in editionslist" :key="index">
  9. <header>
  10. <h2>{{ corpus.author.title }}</h2>
  11. <h3>{{ corpus.author.date }}</h3>
  12. </header>
  13. <section class="editions">
  14. <h4 class="editions-quantity">
  15. {{ corpus.author.editionsQuantity.quantity }} {{ corpus.author.editionsQuantity.unit }}
  16. </h4>
  17. <!-- <div v-if="corpus.author.editions" class="editions" v-html="corpus.author.editions"/> -->
  18. </section>
  19. <section class="texts">
  20. <h4 class="texts-quantity">
  21. {{ corpus.author.textsQuantity.quantity }}
  22. {{ corpus.author.textsQuantity.unit }}
  23. </h4>
  24. <ul class="texts-list">
  25. <li v-for="text in corpus.editions.content" :key="text.uuid">
  26. <h3>
  27. <a
  28. class="title"
  29. :href="text.url"
  30. :uuid="text.uuid"
  31. @click.prevent="onclick"
  32. @keyup.enter="onclick"
  33. v-html="text.title"
  34. />
  35. </h3>
  36. <p
  37. class="biblio"
  38. v-html="text.biblio.description"
  39. />
  40. </li>
  41. </ul>
  42. </section>
  43. <!-- <CorpusItem :item="item" /> -->
  44. </li>
  45. </ul>
  46. <template v-slot:nav />
  47. </MainContentLayout>
  48. </template>
  49. <script>
  50. // import CorpusItem from '../components/Content/CorpusItem'
  51. import MainContentLayout from '../components/Layouts/MainContentLayout'
  52. import { mapState, mapActions } from 'vuex'
  53. export default {
  54. name: 'ListCorpus',
  55. metaInfo: {
  56. title: 'Corpus'
  57. },
  58. components: {
  59. // CorpusItem,
  60. MainContentLayout
  61. },
  62. data: () => ({
  63. // editionslist: []
  64. }),
  65. computed: {
  66. ...mapState({
  67. editionslist: state => state.Corpus.editionslist
  68. })
  69. },
  70. created () {
  71. if (!this.editionslist.length) {
  72. this.getCorpuses()
  73. }
  74. },
  75. methods: {
  76. ...mapActions({
  77. getCorpuses: 'Corpus/getCorpuses'
  78. }),
  79. onclick (e) {
  80. console.log('clicked on editon', e)
  81. this.$router.push({
  82. name: `edition`,
  83. params: { id: e.target.getAttribute('uuid') }
  84. })
  85. }
  86. }
  87. }
  88. </script>
  89. <style lang="scss" scoped>
  90. </style>