You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

237 lines
10 KiB

  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row, wrap, v-if='page.id')
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/svg/icon-view-details.svg', alt='Edit Page', style='width: 80px;')
  7. .admin-header-title
  8. .headline.blue--text.text--darken-2.animated.fadeInLeft Page Details
  9. .subtitle-1.grey--text.animated.fadeInLeft.wait-p2s
  10. v-chip.ml-0.mr-2(label, small).caption ID {{page.id}}
  11. span /{{page.locale}}/{{page.path}}
  12. v-spacer
  13. template(v-if='page.isPublished')
  14. status-indicator.mr-3(positive, pulse)
  15. .caption.green--text {{$t('common:page.published')}}
  16. template(v-else)
  17. status-indicator.mr-3(negative, pulse)
  18. .caption.red--text {{$t('common:page.unpublished')}}
  19. template(v-if='page.isPrivate')
  20. status-indicator.mr-3.ml-4(intermediary, pulse)
  21. .caption.deep-orange--text {{$t('common:page.private')}}
  22. template(v-else)
  23. status-indicator.mr-3.ml-4(active, pulse)
  24. .caption.blue--text {{$t('common:page.global')}}
  25. v-spacer
  26. v-btn.mx-1.animated.fadeInRight.wait-p4s(color='grey', large, outlined, to='/pages')
  27. v-icon mdi-arrow-left
  28. v-divider.mx-1.animated.fadeInRight.wait-p3s.mx-1(vertical)
  29. v-dialog(v-model='deletePageDialog', max-width='500')
  30. template(v-slot:activator='{ on }')
  31. v-btn.mx-1.animated.fadeInDown.wait-p1s(color='red', large, outlined, v-on='on')
  32. v-icon(color='red') mdi-trash-can-outline
  33. v-card
  34. .dialog-header.is-short.is-red
  35. v-icon.mr-2(color='white') mdi-file-document-box-remove-outline
  36. span {{$t('common:page.delete')}}
  37. v-card-text.pt-5
  38. i18next.body-2(path='common:page.deleteTitle', tag='div')
  39. span.red--text.text--darken-2(place='title') {{page.title}}
  40. .caption {{$t('common:page.deleteSubtitle')}}
  41. v-chip.mt-3.ml-0.mr-1(label, color='red lighten-4', disabled, small)
  42. .caption.red--text.text--darken-2 {{page.locale.toUpperCase()}}
  43. v-chip.mt-3.mx-0(label, color='red lighten-5', disabled, small)
  44. span.red--text.text--darken-2 /{{page.path}}
  45. v-card-chin
  46. v-spacer
  47. v-btn(text, @click='deletePageDialog = false', :disabled='loading') {{$t('common:actions.cancel')}}
  48. v-btn(color='red darken-2', @click='deletePage', :loading='loading').white--text {{$t('common:actions.delete')}}
  49. v-btn.ml-1.animated.fadeInDown(color='teal', large, outlined, @click='rerenderPage')
  50. v-icon(left) mdi-cube-scan
  51. span Re-render
  52. v-flex(xs12, lg6)
  53. v-card.animated.fadeInUp
  54. v-toolbar(color='primary', dense, dark, flat)
  55. v-icon.mr-2 mdi-text-subject
  56. span Properties
  57. v-list.py-0(two-line, dense)
  58. v-list-item
  59. v-list-item-content
  60. v-list-item-title: .overline.grey--text Title
  61. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.title }}
  62. v-divider
  63. v-list-item
  64. v-list-item-content
  65. v-list-item-title: .overline.grey--text Description
  66. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.description || '-' }}
  67. v-divider
  68. v-list-item
  69. v-list-item-content
  70. v-list-item-title: .overline.grey--text Locale
  71. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.locale }}
  72. v-list-item-action
  73. v-btn(icon, x-small)
  74. v-icon(color='grey') mdi-pencil
  75. v-divider
  76. v-list-item
  77. v-list-item-content
  78. v-list-item-title: .overline.grey--text Path
  79. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.path }}
  80. v-list-item-action
  81. v-btn(icon, x-small)
  82. v-icon(color='grey') mdi-pencil
  83. v-divider
  84. v-list-item
  85. v-list-item-content
  86. v-list-item-title: .overline.grey--text Editor
  87. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.editor || '?' }}
  88. v-divider
  89. v-list-item
  90. v-list-item-content
  91. v-list-item-title: .overline.grey--text Content Type
  92. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.contentType || '?' }}
  93. v-toolbar.elevation-2.mt-3.animated.fadeInUp.wait-p4s(:color='$vuetify.theme.dark ? `grey darken-3-d5` : `white`', dense)
  94. v-spacer
  95. v-btn(color='primary', text, :href='`/` + page.locale + `/` + page.path')
  96. v-icon(left) mdi-text-subject
  97. span View
  98. v-divider.mx-2(vertical)
  99. v-btn(color='primary', text, :href='`/e/` + page.locale + `/` + page.path')
  100. v-icon(left) mdi-pencil
  101. span Edit
  102. v-divider.mx-2(vertical)
  103. v-btn(color='primary', text, :href='`/s/` + page.locale + `/` + page.path')
  104. v-icon(left) mdi-code-tags
  105. span Source
  106. v-divider.mx-2(vertical)
  107. v-btn(color='primary', text, :href='`/h/` + page.locale + `/` + page.path')
  108. v-icon(left) mdi-history
  109. span History
  110. v-spacer
  111. .caption.mt-4.grey--text.animated.fadeInUp.wait-p6s Page Hash: {{ page.hash }}
  112. v-flex(xs12, lg6)
  113. v-card.animated.fadeInUp.wait-p2s
  114. v-toolbar(color='primary', dense, dark, flat)
  115. v-icon.mr-2 mdi-account-multiple
  116. span Users
  117. v-list.py-0(two-line, dense)
  118. v-list-item
  119. v-list-item-avatar(size='24')
  120. v-btn(icon, :to='`/users/` + page.creatorId')
  121. v-icon(color='grey') mdi-account
  122. v-list-item-content
  123. v-list-item-title: .overline.grey--text Creator
  124. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.creatorName }} #[em.caption ({{ page.creatorEmail }})]
  125. v-list-item-action
  126. v-list-item-action-text {{ page.createdAt | moment('calendar') }}
  127. v-divider
  128. v-list-item
  129. v-list-item-avatar(size='24')
  130. v-btn(icon, :to='`/users/` + page.authorId')
  131. v-icon(color='grey') mdi-account
  132. v-list-item-content
  133. v-list-item-title: .overline.grey--text Last Editor
  134. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.authorName }} #[em.caption ({{ page.authorEmail }})]
  135. v-list-item-action
  136. v-list-item-action-text {{ page.updatedAt | moment('calendar') }}
  137. v-card.mt-3.animated.fadeInUp.wait-p4s
  138. v-toolbar(color='primary', dense, dark, flat)
  139. v-icon.mr-2 mdi-history
  140. span Recent History
  141. v-spacer
  142. v-chip(label, color='white', small).primary--text coming soon
  143. v-timeline.mx-3(dense, clipped)
  144. v-timeline-item(color='teal', small, v-if='page.createdAt !== page.updatedAt')
  145. v-layout(justify-space-between)
  146. v-flex(xs7).body-2 Page Modified by #[strong {{ page.authorName }}] #[em.caption ({{ page.authorEmail }})]
  147. v-flex.text-right(xs5).caption.grey--text.text-darken-2 {{ page.updatedAt | moment('calendar') }}
  148. v-timeline-item(hide-dot, small)
  149. .body-2 ...
  150. v-btn.mx-0.mt-1(outlined, color='grey', :href='`/h/` + page.locale + `/` + page.path') View Full History
  151. .body-2 ...
  152. v-timeline-item(color='pink', small)
  153. v-layout(justify-space-between)
  154. v-flex(xs7).body-2 Page created by #[strong {{ page.creatorName }}] #[em.caption ({{ page.creatorEmail }})]
  155. v-flex.text-right(xs5).caption.grey--text.text-darken-2 {{ page.createdAt | moment('calendar') }}
  156. v-layout(row, align-center, v-else)
  157. v-progress-circular(indeterminate, width='2', color='grey')
  158. .body-2.pl-3.grey--text {{ $t('common:page.loading') }}
  159. </template>
  160. <script>
  161. import _ from 'lodash'
  162. import { StatusIndicator } from 'vue-status-indicator'
  163. import pageQuery from 'gql/admin/pages/pages-query-single.gql'
  164. import deletePageMutation from 'gql/common/common-pages-mutation-delete.gql'
  165. export default {
  166. components: {
  167. StatusIndicator
  168. },
  169. data() {
  170. return {
  171. deletePageDialog: false,
  172. page: {},
  173. loading: false
  174. }
  175. },
  176. methods: {
  177. async deletePage() {
  178. this.loading = true
  179. this.$store.commit(`loadingStart`, 'page-delete')
  180. try {
  181. const resp = await this.$apollo.mutate({
  182. mutation: deletePageMutation,
  183. variables: {
  184. id: this.page.id
  185. }
  186. })
  187. if (_.get(resp, 'data.pages.delete.responseResult.succeeded', false)) {
  188. this.$store.commit('showNotification', {
  189. style: 'green',
  190. message: `Page deleted successfully.`,
  191. icon: 'check'
  192. })
  193. this.$router.replace('/pages')
  194. } else {
  195. throw new Error(_.get(resp, 'data.pages.delete.responseResult.message', this.$t('common:error.unexpected')))
  196. }
  197. } catch (err) {
  198. this.$store.commit('pushGraphError', err)
  199. }
  200. this.$store.commit(`loadingStop`, 'page-delete')
  201. },
  202. async rerenderPage() {
  203. this.$store.commit('showNotification', {
  204. style: 'indigo',
  205. message: `Coming soon...`,
  206. icon: 'directions_boat'
  207. })
  208. }
  209. },
  210. apollo: {
  211. page: {
  212. query: pageQuery,
  213. variables() {
  214. return {
  215. id: _.toSafeInteger(this.$route.params.id)
  216. }
  217. },
  218. fetchPolicy: 'network-only',
  219. update: (data) => data.pages.single,
  220. watchLoading (isLoading) {
  221. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-pages-refresh')
  222. }
  223. }
  224. }
  225. }
  226. </script>
  227. <style lang='scss'>
  228. </style>