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.

251 lines
9.5 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(src='/svg/icon-categorize.svg', alt='General', style='width: 80px;')
  7. .admin-header-title
  8. .headline.primary--text {{ $t('admin:general.title') }}
  9. .subheading.grey--text {{ $t('admin:general.subtitle') }}
  10. v-spacer
  11. v-btn(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
  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
  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
  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: 'Google Analytics', value: 'ga' },
  168. { text: 'Google Tag Manager', value: 'gtm' },
  169. ],
  170. metaRobots: [
  171. { text: 'Index', value: 'index' },
  172. { text: 'Follow', value: 'follow' },
  173. { text: 'No Index', value: 'noindex' },
  174. { text: 'No Follow', value: 'nofollow' }
  175. ],
  176. config: {
  177. host: '',
  178. title: '',
  179. description: '',
  180. robots: [],
  181. analyticsService: '',
  182. analyticsId: '',
  183. company: '',
  184. hasLogo: false,
  185. logoIsSquare: false,
  186. featurePageRatings: false,
  187. featurePageComments: false,
  188. featurePersonalWikis: false
  189. }
  190. }
  191. },
  192. computed: {
  193. darkMode: get('site/dark'),
  194. siteTitle: sync('site/title'),
  195. company: sync('site/company')
  196. },
  197. methods: {
  198. async save () {
  199. try {
  200. await this.$apollo.mutate({
  201. mutation: siteUpdateConfigMutation,
  202. variables: {
  203. host: this.config.host || '',
  204. title: this.config.title || '',
  205. description: this.config.description || '',
  206. robots: this.config.robots || [],
  207. analyticsService: this.config.analyticsService || '',
  208. analyticsId: this.config.analyticsId || '',
  209. company: this.config.company || '',
  210. hasLogo: this.config.hasLogo || false,
  211. logoIsSquare: this.config.logoIsSquare || false,
  212. featurePageRatings: this.config.featurePageRatings || false,
  213. featurePageComments: this.config.featurePageComments || false,
  214. featurePersonalWikis: this.config.featurePersonalWikis || false
  215. },
  216. watchLoading (isLoading) {
  217. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
  218. }
  219. })
  220. this.$store.commit('showNotification', {
  221. style: 'success',
  222. message: 'Configuration saved successfully.',
  223. icon: 'check'
  224. })
  225. this.siteTitle = this.config.title
  226. this.company = this.config.company
  227. } catch (err) {
  228. this.$store.commit('pushGraphError', err)
  229. }
  230. }
  231. },
  232. apollo: {
  233. config: {
  234. query: siteConfigQuery,
  235. fetchPolicy: 'network-only',
  236. update: (data) => _.cloneDeep(data.site.config),
  237. watchLoading (isLoading) {
  238. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
  239. }
  240. }
  241. }
  242. }
  243. </script>
  244. <style lang='scss'>
  245. </style>