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.

252 lines
9.7 KiB

  1. <template lang='pug'>
  2. v-container(fluid, grid-list-lg)
  3. v-layout(row wrap)
  4. v-flex(xs12)
  5. .admin-header
  6. img.animated.fadeInUp(src='/svg/icon-categorize.svg', alt='General', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text.animated.fadeInLeft {{ $t('admin:general.title') }}
  9. .subheading.grey--text.animated.fadeInLeft {{ $t('admin:general.subtitle') }}
  10. v-spacer
  11. v-btn.animated.fadeInDown(color='success', depressed, @click='save', large)
  12. v-icon(left) check
  13. span {{$t('common:actions.apply')}}
  14. v-form.pt-3
  15. v-layout(row wrap)
  16. v-flex(lg6 xs12)
  17. v-form
  18. v-card.wiki-form.animated.fadeInUp
  19. v-toolbar(color='primary', dark, dense, flat)
  20. v-toolbar-title
  21. .subheading {{ $t('admin:general.siteInfo') }}
  22. v-subheader General
  23. .px-3.pb-3
  24. v-text-field(
  25. outline
  26. label='Site URL'
  27. required
  28. :counter='255'
  29. v-model='config.host'
  30. prepend-icon='label_important'
  31. hint='Full URL to your wiki, without the trailing slash. (e.g. https://wiki.example.com)'
  32. persistent-hint
  33. )
  34. v-text-field.mt-2(
  35. outline
  36. label='Site Title'
  37. required
  38. :counter='50'
  39. v-model='config.title'
  40. prepend-icon='public'
  41. hint='Displayed in the top bar and appended to all pages meta title.'
  42. persistent-hint
  43. )
  44. v-divider
  45. v-subheader SEO
  46. .px-3.pb-3
  47. v-text-field(
  48. outline
  49. label='Site Description'
  50. :counter='255'
  51. v-model='config.description'
  52. prepend-icon='explore'
  53. hint='Default description when none is provided for a page.'
  54. persistent-hint
  55. )
  56. v-select.mt-2(
  57. outline
  58. label='Meta Robots'
  59. multiple
  60. :items='metaRobots'
  61. v-model='config.robots'
  62. prepend-icon='explore'
  63. :return-object='false'
  64. hint='Default: Index, Follow. Can also be set on a per-page basis.'
  65. persistent-hint
  66. )
  67. v-divider
  68. v-subheader Analytics #[v-chip.ml-2(label, color='grey', small, outline) coming soon]
  69. .px-3.pb-3
  70. v-select.mt-2(
  71. outline
  72. label='Analytics Service Provider'
  73. :items='analyticsServices'
  74. v-model='config.analyticsService'
  75. prepend-icon='timeline'
  76. persistent-hint
  77. hint='Automatically add tracking code for services like Google Analytics.'
  78. )
  79. v-text-field.mt-2(
  80. v-if='config.analyticsService !== ``'
  81. outline
  82. label='Property Tracking ID'
  83. :counter='255'
  84. v-model='config.analyticsId'
  85. prepend-icon='timeline'
  86. persistent-hint
  87. hint='A unique identifier provided by your analytics service provider.'
  88. )
  89. v-flex(lg6 xs12)
  90. v-card.wiki-form.animated.fadeInUp.wait-p2s
  91. v-toolbar(color='primary', dark, dense, flat)
  92. v-toolbar-title
  93. .subheading {{ $t('admin:general.siteBranding') }}
  94. v-subheader Logo #[v-chip.ml-2(label, color='grey', small, outline) coming soon]
  95. v-card-text
  96. v-layout.px-3(row, align-center)
  97. v-avatar(size='120', :color='$vuetify.dark ? `grey darken-2` : `grey lighten-3`', :tile='config.logoIsSquare')
  98. .ml-4
  99. v-btn.mx-0(color='teal', depressed, disabled)
  100. v-icon(left) cloud_upload
  101. span Upload Logo
  102. v-btn(color='teal', depressed, disabled)
  103. v-icon(left) clear
  104. span Clear
  105. .caption.grey--text An image of 120x120 pixels is recommended for best results.
  106. .caption.grey--text SVG, PNG or JPG files only.
  107. v-switch(
  108. v-model='config.logoIsSquare'
  109. label='Use Square Logo Frame'
  110. color='primary'
  111. persistent-hint
  112. hint='Check this option if a round logo frame doesn\'t work with your logo.'
  113. )
  114. v-divider
  115. v-subheader Footer Copyright
  116. .px-3.pb-3
  117. v-text-field(
  118. outline
  119. label='Company / Organization Name'
  120. v-model='config.company'
  121. :counter='255'
  122. prepend-icon='business'
  123. persistent-hint
  124. hint='Name to use when displaying copyright notice in the footer. Leave empty to hide.'
  125. )
  126. v-card.wiki-form.mt-3.animated.fadeInUp.wait-p4s
  127. v-toolbar(color='primary', dark, dense, flat)
  128. v-toolbar-title
  129. .subheading Features
  130. v-spacer
  131. v-chip(label, color='white', small).primary--text coming soon
  132. v-card-text
  133. v-switch(
  134. label='Page Ratings'
  135. color='primary'
  136. v-model='config.featurePageRatings'
  137. persistent-hint
  138. hint='Allow users to rate pages.'
  139. )
  140. v-divider.mt-3
  141. v-switch(
  142. label='Page Comments'
  143. color='primary'
  144. v-model='config.featurePageComments'
  145. persistent-hint
  146. hint='Allow users to leave comments on pages.'
  147. )
  148. v-divider.mt-3
  149. v-switch(
  150. label='Personal Wikis'
  151. color='primary'
  152. v-model='config.featurePersonalWikis'
  153. persistent-hint
  154. hint='Allow users to have their own personal wiki.'
  155. )
  156. </template>
  157. <script>
  158. import _ from 'lodash'
  159. import { get, sync } from 'vuex-pathify'
  160. import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
  161. import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
  162. export default {
  163. data() {
  164. return {
  165. analyticsServices: [
  166. { text: 'None', value: '' },
  167. { text: 'Elasticsearch APM', value: 'elk' },
  168. { text: 'Google Analytics', value: 'ga' },
  169. { text: 'Google Tag Manager', value: 'gtm' }
  170. ],
  171. metaRobots: [
  172. { text: 'Index', value: 'index' },
  173. { text: 'Follow', value: 'follow' },
  174. { text: 'No Index', value: 'noindex' },
  175. { text: 'No Follow', value: 'nofollow' }
  176. ],
  177. config: {
  178. host: '',
  179. title: '',
  180. description: '',
  181. robots: [],
  182. analyticsService: '',
  183. analyticsId: '',
  184. company: '',
  185. hasLogo: false,
  186. logoIsSquare: false,
  187. featurePageRatings: false,
  188. featurePageComments: false,
  189. featurePersonalWikis: false
  190. }
  191. }
  192. },
  193. computed: {
  194. darkMode: get('site/dark'),
  195. siteTitle: sync('site/title'),
  196. company: sync('site/company')
  197. },
  198. methods: {
  199. async save () {
  200. try {
  201. await this.$apollo.mutate({
  202. mutation: siteUpdateConfigMutation,
  203. variables: {
  204. host: this.config.host || '',
  205. title: this.config.title || '',
  206. description: this.config.description || '',
  207. robots: this.config.robots || [],
  208. analyticsService: this.config.analyticsService || '',
  209. analyticsId: this.config.analyticsId || '',
  210. company: this.config.company || '',
  211. hasLogo: this.config.hasLogo || false,
  212. logoIsSquare: this.config.logoIsSquare || false,
  213. featurePageRatings: this.config.featurePageRatings || false,
  214. featurePageComments: this.config.featurePageComments || false,
  215. featurePersonalWikis: this.config.featurePersonalWikis || false
  216. },
  217. watchLoading (isLoading) {
  218. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
  219. }
  220. })
  221. this.$store.commit('showNotification', {
  222. style: 'success',
  223. message: 'Configuration saved successfully.',
  224. icon: 'check'
  225. })
  226. this.siteTitle = this.config.title
  227. this.company = this.config.company
  228. } catch (err) {
  229. this.$store.commit('pushGraphError', err)
  230. }
  231. }
  232. },
  233. apollo: {
  234. config: {
  235. query: siteConfigQuery,
  236. fetchPolicy: 'network-only',
  237. update: (data) => _.cloneDeep(data.site.config),
  238. watchLoading (isLoading) {
  239. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
  240. }
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang='scss'>
  246. </style>