Gallery.vue 4.4 KB

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