app.vue 6.0 KB

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