navigator.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <template lang="pug">
  2. .navigator
  3. .navigator-bar
  4. .navigator-fab
  5. .navigator-fab-button(@click='toggleMainMenu')
  6. svg.icons.is-24(role='img')
  7. title Navigation
  8. use(xlink:href='#gg-apps-grid')
  9. .navigator-title
  10. h1 {{ siteTitle }}
  11. .navigator-subtitle(:class='subtitleClass')
  12. transition(name='navigator-subtitle-icon')
  13. svg.icons.is-24.navigator-subtitle-icon(role='img', v-if='subtitleIcon')
  14. title {{subtitleText}}
  15. use(:xlink:href='subtitleIconClass')
  16. h2 {{subtitleText}}
  17. .navigator-action
  18. .navigator-action-item
  19. svg.icons.is-32(role='img')
  20. title User
  21. use(xlink:href='#nc-user-circle')
  22. transition(name='navigator-sd')
  23. .navigator-sd(v-show='sdShown')
  24. .navigator-sd-actions
  25. a.is-active(href='', title='Search')
  26. svg.icons.is-24(role='img')
  27. title Search
  28. use(xlink:href='#gg-search')
  29. a(href='', title='New Document')
  30. svg.icons.is-24(role='img')
  31. title New Document
  32. use(xlink:href='#nc-plus-circle')
  33. a(href='', title='Edit Document')
  34. svg.icons.is-24(role='img')
  35. title Edit Document
  36. use(xlink:href='#nc-pen-red')
  37. a(href='', title='History')
  38. svg.icons.is-24(role='img')
  39. title History
  40. use(xlink:href='#nc-restore')
  41. a(href='', title='View Source')
  42. svg.icons.is-24(role='img')
  43. title View Source
  44. use(xlink:href='#nc-code-editor')
  45. a(href='', title='Move Document')
  46. svg.icons.is-24(role='img')
  47. title Move Document
  48. use(xlink:href='#nc-move')
  49. a(href='', title='Delete Document')
  50. svg.icons.is-24(role='img')
  51. title Delete Document
  52. use(xlink:href='#nc-trash')
  53. .navigator-sd-search
  54. input(type='text', ref='iptSearch', placeholder='Search')
  55. .navigator-sd-results
  56. .navigator-sd-footer
  57. a(href='', title='Settings')
  58. svg.icons.is-24(role='img')
  59. title Settings
  60. use(xlink:href='#nc-gear')
  61. a(href='', title='Users')
  62. svg.icons.is-24(role='img')
  63. title Users
  64. use(xlink:href='#nc-users')
  65. a(href='', title='Assets')
  66. svg.icons.is-24(role='img')
  67. title Assets
  68. use(xlink:href='#nc-image')
  69. </template>
  70. <script>
  71. /* global CONSTANTS, graphQL, siteConfig */
  72. import { mapState } from 'vuex'
  73. export default {
  74. name: 'navigator',
  75. data() {
  76. return {
  77. sdShown: false
  78. }
  79. },
  80. computed: {
  81. ...mapState('navigator', [
  82. 'subtitleShown',
  83. 'subtitleStyle',
  84. 'subtitleText',
  85. 'subtitleIcon'
  86. ]),
  87. siteTitle() {
  88. return siteConfig.title
  89. },
  90. subtitleClass() {
  91. return {
  92. 'is-active': this.subtitleShown,
  93. 'is-error': this.subtitleStyle === 'error',
  94. 'is-warning': this.subtitleStyle === 'warning',
  95. 'is-success': this.subtitleStyle === 'success',
  96. 'is-info': this.subtitleStyle === 'info'
  97. }
  98. },
  99. subtitleIconClass() { return '#' + this.subtitleIcon }
  100. },
  101. methods: {
  102. toggleMainMenu() {
  103. this.sdShown = !this.sdShown
  104. if (this.sdShown) {
  105. this.$nextTick(() => {
  106. this.$refs.iptSearch.focus()
  107. })
  108. }
  109. // this.$store.dispatch('navigator/alert', {
  110. // style: 'success',
  111. // icon: 'gg-check',
  112. // msg: 'Changes were saved successfully!'
  113. // })
  114. }
  115. },
  116. mounted() {
  117. }
  118. }
  119. </script>