Nominum.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <template>
  2. <MainContentLayout id="nominum">
  3. <template v-if="!content" v-slot:header>
  4. <span class="loading">Loading ...</span>
  5. </template>
  6. <template v-if="content" v-slot:header>
  7. <h1>{{ content.title }}</h1>
  8. <p>
  9. {{ content.birthDate }}, {{ content.birthPlace }}<br>
  10. {{ content.deathDate }}, {{ content.deathPlace }}
  11. </p>
  12. </template>
  13. <!-- default slot -->
  14. <section class="occurences">
  15. <ul>
  16. <li
  17. v-for="ed in content.occurences"
  18. :key="ed.item"
  19. >
  20. <h3>
  21. <a
  22. :href="'/edition/'+ed.item"
  23. :uuid="ed.item"
  24. @click.prevent="onclick"
  25. @keyup.enter="onclick"
  26. >
  27. {{ ed.item }}
  28. </a>
  29. </h3>
  30. <ul >
  31. <li
  32. v-for="oc in ed.occurences"
  33. :key="oc.uuid"
  34. >
  35. <h4>
  36. <a
  37. :href="'/edition/'+ed.item+'/'+oc.uuid"
  38. :uuid="oc.uuid"
  39. :eduuid="ed.item"
  40. @click.prevent="onclick"
  41. @keyup.enter="onclick"
  42. >
  43. {{ oc.title }}
  44. </a>
  45. </h4>
  46. </li>
  47. </ul>
  48. </li>
  49. </ul>
  50. </section>
  51. <template v-slot:nav />
  52. </MainContentLayout>
  53. </template>
  54. <script>
  55. import { REST } from 'api/rest-axios'
  56. import MainContentLayout from '../components/Layouts/MainContentLayout'
  57. export default {
  58. name: 'Nominum',
  59. components: {
  60. MainContentLayout
  61. },
  62. data: () => ({
  63. content: null
  64. }),
  65. beforeCreate () {
  66. console.log('nominum this.$route', this.$route)
  67. REST.get(`/indexNominum/` + this.$route.params.id, {})
  68. .then(({ data }) => {
  69. console.log('nominum REST: data', data)
  70. if (data.content) {
  71. this.content = data.content
  72. }
  73. })
  74. .catch((error) => {
  75. console.warn('Issue with nominum', error)
  76. Promise.reject(error)
  77. })
  78. },
  79. methods: {
  80. onclick (e) {
  81. console.log('clicked on nominum text occurence', e)
  82. if (e.target.getAttribute('eduuid')) {
  83. this.$router.push({
  84. name: `editiontext`,
  85. params: {
  86. id: e.target.getAttribute('eduuid'),
  87. textid: e.target.getAttribute('uuid')
  88. }
  89. })
  90. } else {
  91. this.$router.push({
  92. name: `edition`,
  93. params: {
  94. id: e.target.getAttribute('uuid')
  95. }
  96. })
  97. }
  98. }
  99. }
  100. }
  101. </script>
  102. <style lang="scss" scoped>
  103. </style>