Nominum.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <MainContentLayout id="nominum" class="index-item">
  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 v-html="content.title" />
  8. <p>
  9. {{ content.birthDate }}, {{ content.birthPlace }}<br>
  10. {{ content.deathDate }}, {{ content.deathPlace }}
  11. </p>
  12. <p v-if="content.occupation">{{ content.occupation }}</p>
  13. <section class="notes">
  14. <div v-for="(note, i) in content.note" :key="i" class="note" v-html="note" />
  15. </section>
  16. <section v-if="content.autorities.length" class="autorities">
  17. <h3>Autorities</h3>
  18. <ul>
  19. <li v-for="(aut, i) in content.autorities" :key="i">
  20. <a :href="aut.identifier" target="_blanck">{{ aut.autority }}</a>
  21. </li>
  22. </ul>
  23. </section>
  24. </template>
  25. <!-- default slot -->
  26. <IndexItemOcurrences v-if="content" :content="content" />
  27. <template v-if="content" v-slot:nav>
  28. <section v-if="content.attestedForms" class="attested-forms">
  29. <h3>Attested forms</h3>
  30. <ul>
  31. <li v-for="(af, i) in content.attestedForms" :key="i">
  32. <h4>{{ af.title }}</h4>
  33. <ul>
  34. <li v-for="(uuid, j) in af.uuid" :key="j">
  35. <a href="#">{{ uuid }}</a>
  36. </li>
  37. </ul>
  38. </li>
  39. </ul>
  40. </section>
  41. </template>
  42. </MainContentLayout>
  43. </template>
  44. <script>
  45. import { REST } from 'api/rest-axios'
  46. import MainContentLayout from '../components/Layouts/MainContentLayout'
  47. import IndexItemOcurrences from '../components/Content/IndexItemOcurrences'
  48. export default {
  49. name: 'Nominum',
  50. components: {
  51. MainContentLayout,
  52. IndexItemOcurrences
  53. },
  54. data: () => ({
  55. content: null
  56. }),
  57. metaInfo () {
  58. return {
  59. title: `Nominum ${this.$route.params.id}`
  60. }
  61. },
  62. created () {
  63. console.log('nominum this.$route', this.$route)
  64. REST.get(`${window.apipath}/indexNominum/` + this.$route.params.id, {})
  65. .then(({ data }) => {
  66. console.log('nominum REST: data', data)
  67. if (data.content) {
  68. this.parseOccurences(data.content)
  69. }
  70. })
  71. .catch((error) => {
  72. console.warn('Issue with nominum', error)
  73. Promise.reject(error)
  74. this.$router.replace({
  75. name: 'notfound',
  76. query: { fullpath: this.$route.path }
  77. })
  78. })
  79. },
  80. methods: {
  81. parseOccurences (content) {
  82. console.log('parseOccurences', content)
  83. for (let i = 0; i < content.occurences.length; i++) {
  84. let ed = content.occurences[i]
  85. for (let j = 0; j < ed.occurences.length; j++) {
  86. let o = ed.occurences[j]
  87. const uuid = o.uuid
  88. for (let k = 0; k < content.attestedForms.length; k++) {
  89. const form = content.attestedForms[k]
  90. if (form.uuid.indexOf(uuid) >= 0) {
  91. content.occurences[i].occurences[j].form = form.title
  92. break
  93. }
  94. console.warn('no form for occurence', o.uuid, o.title)
  95. content.occurences[i].occurences[j].form = ''
  96. }
  97. }
  98. }
  99. this.content = content
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. </style>