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.

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