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.

222 lines
6.1 KiB

  1. <template lang="pug">
  2. v-app
  3. nav-header
  4. v-navigation-drawer.primary(
  5. dark
  6. app
  7. clipped
  8. :mini-variant='$vuetify.breakpoint.md || $vuetify.breakpoint.sm'
  9. mini-variant-width='80'
  10. mobile-break-point='600'
  11. :temporary='$vuetify.breakpoint.xs'
  12. v-model='navShown'
  13. )
  14. nav-sidebar
  15. v-content
  16. v-toolbar(color='grey lighten-3', flat, dense)
  17. v-btn.pl-0(v-if='$vuetify.breakpoint.xsOnly', flat, @click='toggleNavigation')
  18. v-icon(color='grey darken-2', left) menu
  19. span Navigation
  20. v-breadcrumbs.pl-0(v-else, divider='/')
  21. v-breadcrumbs-item: v-icon home
  22. v-breadcrumbs-item Universe
  23. v-breadcrumbs-item Galaxy
  24. v-breadcrumbs-item Solar System
  25. v-breadcrumbs-item Planet Earth
  26. template(v-if='!isPublished')
  27. v-spacer
  28. .caption.red--text Unpublished
  29. status-indicator.ml-3(negative, pulse)
  30. v-divider
  31. v-layout(row)
  32. v-flex(xs12, lg9, xl10)
  33. v-toolbar(color='grey lighten-4', flat, :height='90')
  34. div
  35. .headline.grey--text.text--darken-3 {{title}}
  36. .caption.grey--text.text--darken-1 {{description}}
  37. v-divider
  38. .contents(ref='container')
  39. slot(name='contents')
  40. v-flex(lg3, xl2, fill-height, v-if='$vuetify.breakpoint.lgAndUp')
  41. v-toolbar(color='grey lighten-4', flat, :height='90')
  42. div
  43. .caption.grey--text.text--lighten-1 Last edited by
  44. .body-2.grey--text.text--darken-3 {{ authorName }}
  45. .caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}
  46. v-spacer
  47. v-tooltip(left)
  48. v-btn(icon, slot='activator', :href='"/e/" + path')
  49. v-icon(color='grey') edit
  50. span Edit Page
  51. v-divider
  52. v-list.grey.lighten-3.pb-3(dense)
  53. v-subheader.pl-4.primary--text Table of contents
  54. vue-tree-navigation.treenav(:items='toc', :defaultOpenLevel='1')
  55. v-divider
  56. v-list.grey.lighten-4(dense)
  57. v-subheader.pl-4.yellow--text.text--darken-4 Rating
  58. .text-xs-center
  59. v-rating(
  60. v-model='rating'
  61. color='yellow darken-3'
  62. background-color='grey lighten-1'
  63. half-increments
  64. hover
  65. )
  66. .pb-2.caption.grey--text 5 votes
  67. v-divider
  68. v-list.grey.lighten-3(dense)
  69. v-subheader.pl-4.teal--text Tags
  70. v-list-tile
  71. v-list-tile-avatar: v-icon(color='teal') label
  72. v-list-tile-title Astrophysics
  73. v-divider(inset)
  74. v-list-tile
  75. v-list-tile-avatar: v-icon(color='teal') label
  76. v-list-tile-title Space
  77. v-divider(inset)
  78. v-list-tile
  79. v-list-tile-avatar: v-icon(color='teal') label
  80. v-list-tile-title Planets
  81. v-divider
  82. v-toolbar(color='grey lighten-4', flat, dense)
  83. v-spacer
  84. v-tooltip(bottom)
  85. v-btn(icon, slot='activator'): v-icon(color='grey') bookmark
  86. span Bookmark
  87. v-tooltip(bottom)
  88. v-btn(icon, slot='activator'): v-icon(color='grey') share
  89. span Share
  90. v-tooltip(bottom)
  91. v-btn(icon, slot='activator'): v-icon(color='grey') print
  92. span Print Format
  93. v-spacer
  94. nav-footer
  95. </template>
  96. <script>
  97. import { StatusIndicator } from 'vue-status-indicator'
  98. import Prism from '@/libs/prism/prism.js'
  99. export default {
  100. components: {
  101. StatusIndicator
  102. },
  103. props: {
  104. locale: {
  105. type: String,
  106. default: 'en'
  107. },
  108. path: {
  109. type: String,
  110. default: 'home'
  111. },
  112. title: {
  113. type: String,
  114. default: 'Untitled Page'
  115. },
  116. description: {
  117. type: String,
  118. default: ''
  119. },
  120. createdAt: {
  121. type: String,
  122. default: ''
  123. },
  124. updatedAt: {
  125. type: String,
  126. default: ''
  127. },
  128. tags: {
  129. type: Array,
  130. default: () => ([])
  131. },
  132. authorName: {
  133. type: String,
  134. default: 'Unknown'
  135. },
  136. authorId: {
  137. type: Number,
  138. default: 0
  139. },
  140. isPublished: {
  141. type: Boolean,
  142. default: false
  143. }
  144. },
  145. data() {
  146. return {
  147. navOpen: false,
  148. toc: [
  149. {
  150. name: 'Introduction',
  151. element: 'introduction'
  152. },
  153. {
  154. name: 'Cities',
  155. element: 'cities',
  156. children: [
  157. {
  158. name: 'New York',
  159. element: 'contact',
  160. children: [
  161. { name: 'E-mail', element: 'email' },
  162. { name: 'Phone', element: 'phone' }
  163. ]
  164. },
  165. {
  166. name: 'Chicago',
  167. element: 'contact',
  168. children: [
  169. { name: 'E-mail', element: 'email' },
  170. { name: 'Phone', element: 'phone' }
  171. ]
  172. }
  173. ]
  174. },
  175. { name: 'Population', external: 'https://github.com' }
  176. ]
  177. }
  178. },
  179. computed: {
  180. navShown: {
  181. get() { return this.navOpen || this.$vuetify.breakpoint.smAndUp },
  182. set(val) { this.navOpen = val }
  183. },
  184. rating: {
  185. get () {
  186. return 3.5
  187. },
  188. set (val) {
  189. }
  190. }
  191. },
  192. created() {
  193. this.$store.commit('page/SET_AUTHOR_ID', this.authorId)
  194. this.$store.commit('page/SET_AUTHOR_NAME', this.authorName)
  195. this.$store.commit('page/SET_CREATED_AT', this.createdAt)
  196. this.$store.commit('page/SET_DESCRIPTION', this.description)
  197. this.$store.commit('page/SET_IS_PUBLISHED', this.isPublished)
  198. this.$store.commit('page/SET_LOCALE', this.locale)
  199. this.$store.commit('page/SET_PATH', this.path)
  200. this.$store.commit('page/SET_TAGS', this.tags)
  201. this.$store.commit('page/SET_TITLE', this.title)
  202. this.$store.commit('page/SET_UPDATED_AT', this.updatedAt)
  203. },
  204. mounted () {
  205. Prism.highlightAllUnder(this.$refs.container)
  206. },
  207. methods: {
  208. toggleNavigation () {
  209. this.navOpen = !this.navOpen
  210. }
  211. }
  212. }
  213. </script>
  214. <style lang="scss">
  215. </style>