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.

235 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='/_assets/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.animated.fadeInDown.wait-p3s(color='grey', icon, outlined, to='/pages')
  27. v-icon mdi-arrow-left
  28. v-menu(offset-y, origin='top right')
  29. template(v-slot:activator='{ on }')
  30. v-btn.mx-3.animated.fadeInDown.wait-p2s(color='black', v-on='on', depressed, dark)
  31. span Actions
  32. v-icon(right) mdi-chevron-down
  33. v-list(dense, nav)
  34. v-list-item(:href='`/` + page.locale + `/` + page.path')
  35. v-list-item-icon
  36. v-icon(color='indigo') mdi-text-subject
  37. v-list-item-title View
  38. v-list-item(:href='`/e/` + page.locale + `/` + page.path')
  39. v-list-item-icon
  40. v-icon(color='indigo') mdi-pencil
  41. v-list-item-title Edit
  42. v-list-item(@click='', disabled)
  43. v-list-item-icon
  44. v-icon(color='grey') mdi-cube-scan
  45. v-list-item-title Re-Render
  46. v-list-item(@click='', disabled)
  47. v-list-item-icon
  48. v-icon(color='grey') mdi-earth-remove
  49. v-list-item-title Unpublish
  50. v-list-item(:href='`/s/` + page.locale + `/` + page.path')
  51. v-list-item-icon
  52. v-icon(color='indigo') mdi-code-tags
  53. v-list-item-title View Source
  54. v-list-item(:href='`/h/` + page.locale + `/` + page.path')
  55. v-list-item-icon
  56. v-icon(color='indigo') mdi-history
  57. v-list-item-title View History
  58. v-list-item(@click='', disabled)
  59. v-list-item-icon
  60. v-icon(color='grey') mdi-content-duplicate
  61. v-list-item-title Duplicate
  62. v-list-item(@click='', disabled)
  63. v-list-item-icon
  64. v-icon(color='grey') mdi-content-save-move-outline
  65. v-list-item-title Move / Rename
  66. v-dialog(v-model='deletePageDialog', max-width='500')
  67. template(v-slot:activator='{ on }')
  68. v-list-item(v-on='on')
  69. v-list-item-icon
  70. v-icon(color='red') mdi-trash-can-outline
  71. v-list-item-title Delete
  72. v-card
  73. .dialog-header.is-short.is-red
  74. v-icon.mr-2(color='white') mdi-file-document-box-remove-outline
  75. span {{$t('common:page.delete')}}
  76. v-card-text.pt-5
  77. i18next.body-2(path='common:page.deleteTitle', tag='div')
  78. span.red--text.text--darken-2(place='title') {{page.title}}
  79. .caption {{$t('common:page.deleteSubtitle')}}
  80. v-chip.mt-3.ml-0.mr-1(label, color='red lighten-4', disabled, small)
  81. .caption.red--text.text--darken-2 {{page.locale.toUpperCase()}}
  82. v-chip.mt-3.mx-0(label, color='red lighten-5', disabled, small)
  83. span.red--text.text--darken-2 /{{page.path}}
  84. v-card-chin
  85. v-spacer
  86. v-btn(text, @click='deletePageDialog = false', :disabled='loading') {{$t('common:actions.cancel')}}
  87. v-btn(color='red darken-2', @click='deletePage', :loading='loading').white--text {{$t('common:actions.delete')}}
  88. v-btn.animated.fadeInDown(color='success', large, depressed, disabled)
  89. v-icon(left) mdi-check
  90. span Save Changes
  91. v-flex(xs12, lg6)
  92. v-card.animated.fadeInUp
  93. v-toolbar(color='primary', dense, dark, flat)
  94. v-icon.mr-2 mdi-text-subject
  95. span Properties
  96. v-list.py-0(two-line, dense)
  97. v-list-item
  98. v-list-item-content
  99. v-list-item-title: .overline.grey--text Title
  100. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.title }}
  101. v-divider
  102. v-list-item
  103. v-list-item-content
  104. v-list-item-title: .overline.grey--text Description
  105. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.description || '-' }}
  106. v-divider
  107. v-list-item
  108. v-list-item-content
  109. v-list-item-title: .overline.grey--text Locale
  110. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.locale }}
  111. v-divider
  112. v-list-item
  113. v-list-item-content
  114. v-list-item-title: .overline.grey--text Path
  115. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.path }}
  116. v-divider
  117. v-list-item
  118. v-list-item-content
  119. v-list-item-title: .overline.grey--text Editor
  120. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.editor || '?' }}
  121. v-divider
  122. v-list-item
  123. v-list-item-content
  124. v-list-item-title: .overline.grey--text Content Type
  125. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.contentType || '?' }}
  126. v-divider
  127. v-list-item
  128. v-list-item-content
  129. v-list-item-title: .overline.grey--text Page Hash
  130. v-list-item-subtitle.body-2(:class='$vuetify.theme.dark ? `grey--text text--lighten-2` : `grey--text text--darken-3`') {{ page.hash }}
  131. v-flex(xs12, lg6)
  132. v-card.animated.fadeInUp.wait-p2s
  133. v-toolbar(color='primary', dense, dark, flat)
  134. v-icon.mr-2 mdi-account-multiple
  135. span Users
  136. v-list.py-0(two-line, dense)
  137. v-list-item
  138. v-list-item-avatar(size='24')
  139. v-btn(icon, :to='`/users/` + page.creatorId')
  140. v-icon(color='grey') mdi-account
  141. v-list-item-content
  142. v-list-item-title: .overline.grey--text Creator
  143. 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 }})]
  144. v-list-item-action
  145. v-list-item-action-text {{ page.createdAt | moment('calendar') }}
  146. v-divider
  147. v-list-item
  148. v-list-item-avatar(size='24')
  149. v-btn(icon, :to='`/users/` + page.authorId')
  150. v-icon(color='grey') mdi-account
  151. v-list-item-content
  152. v-list-item-title: .overline.grey--text Last Editor
  153. 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 }})]
  154. v-list-item-action
  155. v-list-item-action-text {{ page.updatedAt | 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>