Forme.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. <template>
  2. <section :class="{opened: isopened}">
  3. <h4>
  4. <a
  5. v-if="oc.title"
  6. :href="'/edition/'+oc.ed.uuid+'/'+oc.uuid+'/'+form"
  7. :uuid="oc.uuid"
  8. :eduuid="oc.ed.uuid"
  9. :form="form"
  10. @click.prevent="onGoToText"
  11. @keyup.enter="onGoToText"
  12. >
  13. <span v-html="oc.title" /> <span v-if="oc.ed.uuid" class="edition">({{ editionTitle }})</span>
  14. <!-- <span v-if="oc.form" class="form">( "{{ oc.form }}" )</span> -->
  15. </a>
  16. </h4>
  17. <!-- <span
  18. class="open-close"
  19. @click.prevent="onOpenPreview"
  20. @keyup.enter="onOpenPreview"
  21. >
  22. <svg xmlns="http://www.w3.org/2000/svg" width="14" height="10" role="presentation" class="vs__open-indicator">
  23. <path d="M9.211364 7.59931l4.48338-4.867229c.407008-.441854.407008-1.158247 0-1.60046l-.73712-.80023c-.407008-.441854-1.066904-.441854-1.474243 0L7 5.198617 2.51662.33139c-.407008-.441853-1.066904-.441853-1.474243 0l-.737121.80023c-.407008.441854-.407008 1.158248 0 1.600461l4.48338 4.867228L7 10l2.211364-2.40069z" />
  24. </svg>
  25. </span> -->
  26. <!-- <div v-if="content" class="text" v-html="tei" /> -->
  27. <!-- <a
  28. v-if="content"
  29. class="lire-plus"
  30. :href="'/edition/'+ed.item+'/'+oc.uuid"
  31. :uuid="oc.uuid"
  32. :eduuid="ed.item"
  33. @click.prevent="onGoToText"
  34. @keyup.enter="onGoToText"
  35. >
  36. lire plus
  37. </a> -->
  38. </section>
  39. </template>
  40. <script>
  41. // import { REST } from 'api/rest-axios'
  42. import { mapState, mapActions } from 'vuex'
  43. export default {
  44. name: 'Occurence',
  45. props: {
  46. form: String,
  47. oc: Object
  48. },
  49. data: () => ({
  50. content: null,
  51. isopened: false,
  52. tei: ''
  53. }),
  54. computed: {
  55. ...mapState({
  56. editionsbyuuid: state => state.Corpus.editionsbyuuid
  57. }),
  58. editionTitle () {
  59. return this.editionsbyuuid[this.oc.ed.uuid].title
  60. }
  61. },
  62. created () {
  63. console.log('occurence beforeCreate')
  64. // REST.get(`${window.apipath}/items/` + this.oc.uuid, {})
  65. // .then(({ data }) => {
  66. // console.log('occurence text REST: data', data)
  67. // if (data.content) {
  68. // this.content = data.content
  69. // const subString = this.content.tei.substr(0, 500)
  70. // this.tei = subString.substr(0, subString.lastIndexOf(' ')) + ' &hellip;'
  71. // }
  72. // })
  73. // .catch((error) => {
  74. // console.warn('Issue with nominum', error)
  75. // Promise.reject(error)
  76. // })
  77. },
  78. methods: {
  79. ...mapActions({
  80. addHistoryItem: 'History/addItem'
  81. }),
  82. onGoToText (e) {
  83. console.log('clicked on text occurence', e, this.oc.title, this.oc.ed)
  84. if (e.target.getAttribute('eduuid')) {
  85. this.addHistoryItem({
  86. id: e.target.getAttribute('eduuid'),
  87. textid: e.target.getAttribute('uuid'),
  88. title: this.oc.title,
  89. editionTitle: this.editionTitle
  90. })
  91. // if (e.target.getAttribute('form')) {
  92. // this.$router.push({
  93. // name: `editiontext`,
  94. // params: {
  95. // id: e.target.getAttribute('eduuid'),
  96. // textid: e.target.getAttribute('uuid')
  97. // }
  98. // })
  99. // } else {
  100. this.$router.push({
  101. name: `editiontextextract`,
  102. params: {
  103. id: e.target.getAttribute('eduuid'),
  104. textid: e.target.getAttribute('uuid'),
  105. extract: e.target.getAttribute('form')
  106. }
  107. })
  108. // }
  109. } else {
  110. this.$router.push({
  111. name: `edition`,
  112. params: {
  113. id: e.target.getAttribute('uuid')
  114. }
  115. })
  116. }
  117. },
  118. onOpenPreview (e) {
  119. this.isopened = !this.isopened
  120. }
  121. }
  122. }
  123. </script>
  124. <style lang="scss" scoped>
  125. </style>