Gallery.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <div class="gallery">
  3. <b-button v-b-toggle.gallery-map-side variant="creation" class="btn-side left">
  4. {{ $t('map') }}
  5. </b-button>
  6. <side-view id="gallery-map-side">
  7. <template #default="{ hide, visible }">
  8. <gallery-map
  9. v-if="creations && creation"
  10. :nodes="creations" :node="creation"
  11. :visible="visible"
  12. @open-creation="openCreation($event, hide)"
  13. />
  14. </template>
  15. </side-view>
  16. <gallery-view
  17. v-if="creation"
  18. :node="creation" :key="creation ? creation.id : 0"
  19. @open-creation="openCreation"
  20. @view-origin="openLibrary"
  21. />
  22. <b-button v-b-toggle.gallery-index variant="creation" class="btn-side right">
  23. {{ $t('index') }}
  24. </b-button>
  25. <side-view id="gallery-index" right>
  26. <template #default="{ hide }">
  27. <div class="gallery-intro" v-html="intro" />
  28. <ul v-if="creations">
  29. <li v-for="crea in creations" :key="crea.id">
  30. <node-view-title
  31. :node="crea"
  32. tag="h4" link no-date
  33. @open-node="openCreation(crea.id, hide)"
  34. />
  35. </li>
  36. </ul>
  37. </template>
  38. </side-view>
  39. <b-modal
  40. v-if="creation && (creation.iframeUrl || creation.mediaItem)"
  41. :id="'modal-creation' + creation.id"
  42. class="modal-creation"
  43. static hide-footer hide-header
  44. >
  45. <template #default="{ hide, visible }">
  46. <button-expand expanded @click="hide()" />
  47. <template v-if="visible">
  48. <iframe
  49. v-if="creation.iframeUrl"
  50. :src="creation.iframeUrl"
  51. width="100%" height="100%"
  52. />
  53. <component
  54. v-else-if="creation.mediaItem"
  55. :is="creation.mediaItem.is"
  56. :src="creation.mediaItem.url"
  57. controls
  58. />
  59. </template>
  60. </template>
  61. </b-modal>
  62. <b-overlay
  63. :show="!creations || !creation"
  64. spinner-variant="creation"
  65. no-wrap
  66. />
  67. </div>
  68. </template>
  69. <script>
  70. import { mapGetters } from 'vuex'
  71. import { getRelation } from '@/store/utils'
  72. import { SideView } from '@/components/layouts'
  73. import { NodeViewTitle } from '@/components/nodes'
  74. import { GalleryView, GalleryMap } from '@/pages/gallery'
  75. export default {
  76. name: 'Gallery',
  77. components: {
  78. SideView,
  79. GalleryView,
  80. GalleryMap,
  81. NodeViewTitle
  82. },
  83. props: {
  84. id: { type: [Number, String], default: undefined }
  85. },
  86. data () {
  87. return {
  88. intro: ''
  89. }
  90. },
  91. computed: {
  92. ...mapGetters(['creations', 'creation'])
  93. },
  94. methods: {
  95. openCreation (id, hideSideView) {
  96. this.$store.dispatch('OPEN_CREATION', id)
  97. if (hideSideView) hideSideView()
  98. },
  99. openLibrary () {
  100. this.$store.dispatch('OPEN_NODE', getRelation(this.creation))
  101. }
  102. },
  103. watch: {
  104. id (id, prev) {
  105. this.$store.dispatch('DISPLAY_CREATION', parseInt(this.id))
  106. }
  107. },
  108. created () {
  109. this.$store.dispatch('INIT_GALLERY', parseInt(this.id))
  110. this.$store.dispatch('QUERY_PAGE', 'gallery').then(page => {
  111. this.intro = page.content
  112. })
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .gallery {
  118. position: relative;
  119. width: 100%;
  120. height: 100%;
  121. display: flex;
  122. flex-direction: column;
  123. justify-content: space-between;
  124. @media (orientation: landscape) {
  125. flex-direction: row;
  126. }
  127. .btn-side {
  128. position: absolute;
  129. border-radius: 0 !important;
  130. align-self: center;
  131. min-height: 35px;
  132. min-width: 65px;
  133. text-align: center;
  134. border: $line;
  135. font-weight: $font-weight-bold;
  136. line-height: 0;
  137. @include media-breakpoint-up($size-bp) {
  138. min-height: 50px;
  139. min-width: 80px;
  140. }
  141. &.left {
  142. border-top: 0;
  143. @media (orientation: portrait) {
  144. top: 0;
  145. }
  146. @media (orientation: landscape) {
  147. transform: rotate(-90deg) translate(0, -15px);
  148. margin-right: -30px;
  149. }
  150. }
  151. &.right {
  152. @media (orientation: portrait) {
  153. bottom: 0;
  154. border-bottom: 0;
  155. }
  156. @media (orientation: landscape) {
  157. border-top: 0;
  158. transform: rotate(90deg) translate(0, -15px);
  159. margin-left: -30px;
  160. right: 0;
  161. }
  162. }
  163. }
  164. }
  165. ::v-deep #gallery-map-side {
  166. width: 100%;
  167. .btn-close {
  168. float: unset;
  169. }
  170. }
  171. #gallery-index {
  172. ul {
  173. padding: 0;
  174. list-style: none;
  175. font-family: $font-family-text;
  176. }
  177. }
  178. .modal-creation {
  179. z-index: 1100 !important;
  180. width: 100%;
  181. height: 100%;
  182. pointer-events: none;
  183. ::v-deep .modal {
  184. position: absolute;
  185. background-color: transparent;
  186. width: 100%;
  187. max-height: 100%;
  188. overflow: hidden;
  189. &-dialog {
  190. max-width: 100%;
  191. height: 100%;
  192. margin: 0;
  193. }
  194. &-content {
  195. height: 100%;
  196. border: 0;
  197. }
  198. &-body {
  199. padding: 0;
  200. display: flex;
  201. }
  202. &-backdrop {
  203. display: none;
  204. }
  205. iframe {
  206. border: 0;
  207. }
  208. .btn-expand {
  209. position: absolute;
  210. top: 0;
  211. right: 0;
  212. }
  213. audio {
  214. width: 80%;
  215. margin: auto;
  216. }
  217. video {
  218. width: 100%;
  219. height: 100%;
  220. }
  221. }
  222. }
  223. </style>