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.

249 lines
9.1 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. )
  42. v-divider
  43. v-subheader SEO
  44. .px-3.pb-3
  45. v-text-field(
  46. outline
  47. label='Site Description'
  48. :counter='255'
  49. v-model='config.description'
  50. prepend-icon='explore'
  51. )
  52. v-select.mt-2(
  53. outline
  54. label='Meta Robots'
  55. multiple
  56. :items='metaRobots'
  57. v-model='config.robots'
  58. prepend-icon='explore'
  59. :return-object='false'
  60. hint='Default: Index, Follow'
  61. persistent-hint
  62. )
  63. v-divider
  64. v-subheader Analytics #[v-chip.ml-2(label, color='grey', small, outline) coming soon]
  65. .px-3.pb-3
  66. v-select.mt-2(
  67. outline
  68. label='Analytics Service Provider'
  69. :items='analyticsServices'
  70. v-model='config.analyticsService'
  71. prepend-icon='timeline'
  72. )
  73. v-text-field.mt-2(
  74. v-if='config.analyticsService !== ``'
  75. outline
  76. label='Property Tracking ID'
  77. :counter='255'
  78. v-model='config.analyticsId'
  79. prepend-icon='timeline'
  80. persistent-hint
  81. hint='A unique identifier provided by your analytics service provider.'
  82. )
  83. v-flex(lg6 xs12)
  84. v-card.wiki-form
  85. v-toolbar(color='primary', dark, dense, flat)
  86. v-toolbar-title
  87. .subheading {{ $t('admin:general.siteBranding') }}
  88. v-subheader Logo #[v-chip.ml-2(label, color='grey', small, outline) coming soon]
  89. v-card-text
  90. v-layout.px-3(row, align-center)
  91. v-avatar(size='120', :color='$vuetify.dark ? `grey darken-2` : `grey lighten-3`', :tile='config.logoIsSquare')
  92. .ml-4
  93. v-btn.mx-0(color='teal', depressed, disabled)
  94. v-icon(left) cloud_upload
  95. span Upload Logo
  96. v-btn(color='teal', depressed, disabled)
  97. v-icon(left) clear
  98. span Clear
  99. .caption.grey--text An image of 120x120 pixels is recommended for best results.
  100. .caption.grey--text SVG, PNG or JPG files only.
  101. v-switch(
  102. v-model='config.logoIsSquare'
  103. label='Use Square Logo Frame'
  104. color='primary'
  105. persistent-hint
  106. hint='Check this option if a round logo frame doesn\'t work with your logo.'
  107. )
  108. v-divider
  109. v-subheader Footer Copyright
  110. .px-3.pb-3
  111. v-text-field(
  112. outline
  113. label='Company / Organization Name'
  114. v-model='config.company'
  115. :counter='255'
  116. prepend-icon='business'
  117. persistent-hint
  118. hint='Name to use when displaying copyright notice in the footer. Leave empty to hide.'
  119. )
  120. v-card.wiki-form.mt-3
  121. v-toolbar(color='primary', dark, dense, flat)
  122. v-toolbar-title
  123. .subheading Features
  124. v-spacer
  125. v-chip(label, color='white', small).primary--text coming soon
  126. v-card-text
  127. v-switch(
  128. label='Page Ratings'
  129. color='primary'
  130. v-model='config.featurePageRatings'
  131. persistent-hint
  132. hint='Allow users to rate pages.'
  133. )
  134. v-divider.mt-3
  135. v-switch(
  136. label='Page Comments'
  137. color='primary'
  138. v-model='config.featurePageComments'
  139. persistent-hint
  140. hint='Allow users to leave comments on pages.'
  141. )
  142. v-divider.mt-3
  143. v-switch(
  144. label='Personal Wikis'
  145. color='primary'
  146. v-model='config.featurePersonalWikis'
  147. persistent-hint
  148. hint='Allow users to have their own personal wiki.'
  149. )
  150. </template>
  151. <script>
  152. import _ from 'lodash'
  153. import { get, sync } from 'vuex-pathify'
  154. import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
  155. import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
  156. export default {
  157. data() {
  158. return {
  159. analyticsServices: [
  160. { text: 'None', value: '' },
  161. { text: 'Google Analytics', value: 'ga' },
  162. { text: 'Google Tag Manager', value: 'gtm' },
  163. ],
  164. metaRobots: [
  165. { text: 'Index', value: 'index' },
  166. { text: 'Follow', value: 'follow' },
  167. { text: 'No Index', value: 'noindex' },
  168. { text: 'No Follow', value: 'nofollow' }
  169. ],
  170. config: {
  171. host: '',
  172. title: '',
  173. description: '',
  174. robots: [],
  175. analyticsService: '',
  176. analyticsId: '',
  177. company: '',
  178. hasLogo: false,
  179. logoIsSquare: false,
  180. featurePageRatings: false,
  181. featurePageComments: false,
  182. featurePersonalWikis: false
  183. }
  184. }
  185. },
  186. computed: {
  187. darkMode: get('site/dark'),
  188. siteTitle: sync('site/title'),
  189. company: sync('site/company')
  190. },
  191. methods: {
  192. async save () {
  193. try {
  194. await this.$apollo.mutate({
  195. mutation: siteUpdateConfigMutation,
  196. variables: {
  197. host: this.config.host || '',
  198. title: this.config.title || '',
  199. description: this.config.description || '',
  200. robots: this.config.robots || [],
  201. analyticsService: this.config.analyticsService || '',
  202. analyticsId: this.config.analyticsId || '',
  203. company: this.config.company || '',
  204. hasLogo: this.config.hasLogo || false,
  205. logoIsSquare: this.config.logoIsSquare || false,
  206. featurePageRatings: this.config.featurePageRatings || false,
  207. featurePageComments: this.config.featurePageComments || false,
  208. featurePersonalWikis: this.config.featurePersonalWikis || false
  209. },
  210. watchLoading (isLoading) {
  211. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
  212. }
  213. })
  214. this.$store.commit('showNotification', {
  215. style: 'success',
  216. message: 'Configuration saved successfully.',
  217. icon: 'check'
  218. })
  219. this.siteTitle = this.config.title
  220. this.company = this.config.company
  221. } catch (err) {
  222. this.$store.commit('showNotification', {
  223. style: 'red',
  224. message: err.message,
  225. icon: 'warning'
  226. })
  227. }
  228. }
  229. },
  230. apollo: {
  231. config: {
  232. query: siteConfigQuery,
  233. fetchPolicy: 'network-only',
  234. update: (data) => _.cloneDeep(data.site.config),
  235. watchLoading (isLoading) {
  236. this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
  237. }
  238. }
  239. }
  240. }
  241. </script>
  242. <style lang='scss'>
  243. </style>