feat: admin general + verify account

This commit is contained in:
Nicolas Giard
2018-12-24 01:03:10 -05:00
parent 2b98a5f27a
commit fcee4c0945
22 changed files with 494 additions and 80 deletions

View File

@@ -80,7 +80,7 @@ const graphQLLink = ApolloLink.from([
})
}
}),
createPersistedQueryLink(),
// createPersistedQueryLink(),
new BatchHttpLink({
includeExtensions: true,
uri: graphQLEndpoint,

View File

@@ -22,11 +22,21 @@
v-subheader General
.px-3.pb-3
v-text-field(
outline
label='Site URL'
required
:counter='255'
v-model='config.host'
prepend-icon='label_important'
hint='Full URL to your wiki, without the trailing slash. (e.g. https://wiki.example.com)'
persistent-hint
)
v-text-field.mt-2(
outline
label='Site Title'
required
:counter='50'
v-model='siteTitle'
v-model='config.title'
prepend-icon='public'
)
v-divider
@@ -36,22 +46,28 @@
outline
label='Site Description'
:counter='255'
prepend-icon='public'
v-model='config.description'
prepend-icon='explore'
)
v-text-field(
outline
label='Site Keywords'
:counter='255'
prepend-icon='public'
v-model='config.keywords'
prepend-icon='explore'
hint='Comma-separated list of keywords.'
persistent-hint
)
v-select(
v-select.mt-2(
outline
label='Meta Robots'
chips
tags
multiple
:items='metaRobots'
v-model='metaRobotsSelection'
prepend-icon='public'
v-model='config.robots'
prepend-icon='explore'
:return-object='false'
hint='Default: Index, Follow'
persistent-hint
)
v-divider
v-subheader Analytics
@@ -60,30 +76,20 @@
outline
label='Google Analytics ID'
:counter='255'
v-model='config.ga'
prepend-icon='timeline'
persistent-hint
hint='Property tracking ID for Google Analytics.'
)
v-divider
v-subheader Footer Copyright
.px-3.pb-3
v-text-field(
outline
label='Company / Organization Name'
v-model='company'
:counter='255'
prepend-icon='business'
persistent-hint
hint='Name to use when displaying copyright notice in the footer. Leave empty to hide.'
hint='Property tracking ID for Google Analytics. Leave empty to disable.'
)
v-flex(lg6 xs12)
v-card.wiki-form
v-toolbar(color='primary', dark, dense, flat)
v-toolbar-title
.subheading {{ $t('admin:general.siteBranding') }}
v-subheader Logo
v-card-text
v-layout.pa-3(row, align-center)
v-avatar(size='120', color='grey lighten-3', :tile='useSquareLogo')
v-layout.px-3(row, align-center)
v-avatar(size='120', color='grey lighten-3', :tile='config.logoIsSquare')
.ml-4
v-layout(row, align-center)
v-btn(color='teal', depressed, dark)
@@ -95,19 +101,23 @@
.caption.grey--text An image of 120x120 pixels is recommended for best results.
.caption.grey--text SVG, PNG or JPG files only.
v-switch(
v-model='useSquareLogo'
v-model='config.logoIsSquare'
label='Use Square Logo Frame'
color='primary'
persistent-hint
hint='Check this option if a round logo frame doesn\'t work with your logo.'
)
v-divider.mt-3
v-switch(
v-model='displayMascot'
label='Display Wiki.js Mascot'
color='primary'
v-divider
v-subheader Footer Copyright
.px-3.pb-3
v-text-field(
outline
label='Company / Organization Name'
v-model='config.company'
:counter='255'
prepend-icon='business'
persistent-hint
hint='Uncheck this box if you don\'t want Henry, Wiki.js mascot, to be displayed on client-facing pages.'
hint='Name to use when displaying copyright notice in the footer. Leave empty to hide.'
)
v-card.wiki-form.mt-3
@@ -116,17 +126,25 @@
.subheading Features
v-card-text
v-switch(
v-model='featurePageRatings'
label='Page Ratings'
color='primary'
v-model='config.featurePageRatings'
persistent-hint
hint='Allow users to rate pages.'
)
v-divider.mt-3
v-switch(
v-model='featurePersonalWiki'
label='Page Comments'
color='primary'
v-model='config.featurePageComments'
persistent-hint
hint='Allow users to leave comments on pages.'
)
v-divider.mt-3
v-switch(
label='Personal Wikis'
color='primary'
v-model='config.featurePersonalWikis'
persistent-hint
hint='Allow users to have their own personal wiki.'
)
@@ -134,18 +152,34 @@
</template>
<script>
import _ from 'lodash'
import { get, sync } from 'vuex-pathify'
import siteConfigQuery from 'gql/admin/site/site-query-config.gql'
import siteUpdateConfigMutation from 'gql/admin/site/site-mutation-save-config.gql'
export default {
data() {
return {
metaRobotsSelection: ['Index', 'Follow'],
metaRobots: ['Index', 'Follow', 'No Index', 'No Follow'],
useSquareLogo: false,
displayMascot: true,
featurePageRatings: true,
featurePersonalWiki: true
metaRobots: [
{ text: 'Index', value: 'index' },
{ text: 'Follow', value: 'follow' },
{ text: 'No Index', value: 'noindex' },
{ text: 'No Follow', value: 'nofollow' }
],
config: {
host: '',
title: '',
description: '',
keywords: '',
robots: [],
ga: '',
company: '',
hasLogo: false,
logoIsSquare: false,
featurePageRatings: false,
featurePageComments: false,
featurePersonalWikis: false
}
}
},
computed: {
@@ -155,11 +189,51 @@ export default {
},
methods: {
async save () {
this.$store.commit('showNotification', {
message: 'Configuration saved successfully.',
style: 'success',
icon: 'check'
})
try {
await this.$apollo.mutate({
mutation: siteUpdateConfigMutation,
variables: {
host: this.config.host || '',
title: this.config.title || '',
description: this.config.description || '',
keywords: this.config.keywords || '',
robots: this.config.robots || [],
ga: this.config.ga || '',
company: this.config.company || '',
hasLogo: this.config.hasLogo || false,
logoIsSquare: this.config.logoIsSquare || false,
featurePageRatings: this.config.featurePageRatings || false,
featurePageComments: this.config.featurePageComments || false,
featurePersonalWikis: this.config.featurePersonalWikis || false
},
watchLoading (isLoading) {
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-update')
}
})
this.$store.commit('showNotification', {
style: 'success',
message: 'Configuration saved successfully.',
icon: 'check'
})
this.siteTitle = this.config.title
this.company = this.config.company
} catch (err) {
this.$store.commit('showNotification', {
style: 'red',
message: err.message,
icon: 'warning'
})
}
}
},
apollo: {
config: {
query: siteConfigQuery,
fetchPolicy: 'network-only',
update: (data) => _.cloneDeep(data.site.config),
watchLoading (isLoading) {
this.$store.commit(`loading${isLoading ? 'Start' : 'Stop'}`, 'admin-site-refresh')
}
}
}
}

View File

@@ -82,6 +82,7 @@
item-text='name'
:label='$t("admin:locale.activeNamespaces.label")'
persistent-hint
small-chips
:hint='$t("admin:locale.activeNamespaces.hint")'
)
template(slot='item', slot-scope='data')

View File

@@ -3,10 +3,12 @@
v-card.loader-dialog.radius-7(:color='color', dark)
v-card-text.text-xs-center.py-4
atom-spinner.is-inline(
v-if='mode === `loading`'
:animation-duration='1000'
:size='60'
color='#FFF'
)
img(v-else-if='mode === `icon`', :src='`/svg/icon-` + icon + `.svg`', :alt='icon')
.subheading {{ title }}
.caption {{ subtitle }}
</template>
@@ -34,6 +36,14 @@ export default {
subtitle: {
type: String,
default: 'Please wait'
},
mode: {
type: String,
default: 'loading'
},
icon: {
type: String,
default: 'checkmark'
}
}
}
@@ -47,5 +57,9 @@ export default {
.caption {
color: rgba(255,255,255,.7);
}
img {
width: 80px;
}
}
</style>

View File

@@ -90,7 +90,7 @@
a.caption(href='/login', place='link') {{ $t('auth:switchToLogin.link') }}
v-spacer
loader(v-model='isLoading', :color='loaderColor', :title='loaderTitle', :subtitle='$t(`auth:pleaseWait`)')
loader(v-model='isLoading', :mode='loaderMode', :icon='loaderIcon', :color='loaderColor', :title='loaderTitle', :subtitle='loaderSubtitle')
nav-footer(color='grey darken-4', dark-color='grey darken-4')
</template>
@@ -119,7 +119,10 @@ export default {
isLoading: false,
isShown: false,
loaderColor: 'grey darken-4',
loaderTitle: 'Working...'
loaderTitle: 'Working...',
loaderSubtitle: 'Please wait',
loaderMode: 'icon',
loaderIcon: 'checkmark'
}
},
computed: {
@@ -131,6 +134,7 @@ export default {
this.isShown = true
this.$nextTick(() => {
this.$refs.iptEmail.focus()
})
},
methods: {
@@ -216,6 +220,8 @@ export default {
} else {
this.loaderColor = 'grey darken-4'
this.loaderTitle = this.$t('auth:registering')
this.loaderSubtitle = this.$t(`auth:pleaseWait`)
this.loaderMode = 'loading'
this.isLoading = true
try {
let resp = await this.$apollo.mutate({
@@ -229,12 +235,11 @@ export default {
if (_.has(resp, 'data.authentication.register')) {
let respObj = _.get(resp, 'data.authentication.register', {})
if (respObj.responseResult.succeeded === true) {
this.loaderColor = 'green'
this.loaderColor = 'grey darken-4'
this.loaderTitle = this.$t('auth:registerSuccess')
Cookies.set('jwt', respObj.jwt, { expires: 365 })
_.delay(() => {
window.location.replace('/')
}, 1000)
this.loaderSubtitle = this.$t(`auth:registerCheckEmail`)
this.loaderMode = 'icon'
this.isShown = false
} else {
throw new Error(respObj.responseResult.message)
}

View File

@@ -0,0 +1,38 @@
mutation (
$host: String!
$title: String!
$description: String!
$keywords: String!
$robots: [String]!
$ga: String!
$company: String!
$hasLogo: Boolean!
$logoIsSquare: Boolean!
$featurePageRatings: Boolean!
$featurePageComments: Boolean!
$featurePersonalWikis: Boolean!
) {
site {
updateConfig(
host: $host,
title: $title,
description: $description,
keywords: $keywords,
robots: $robots,
ga: $ga,
company: $company,
hasLogo: $hasLogo,
logoIsSquare: $logoIsSquare,
featurePageRatings: $featurePageRatings,
featurePageComments: $featurePageComments,
featurePersonalWikis: $featurePersonalWikis
) {
responseResult {
succeeded
errorCode
slug
message
}
}
}
}

View File

@@ -0,0 +1,18 @@
{
site {
config {
host
title
description
keywords
robots
ga
company
hasLogo
logoIsSquare
featurePageRatings
featurePageComments
featurePersonalWikis
}
}
}

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 20.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="&#1057;&#1083;&#1086;&#1081;_1" x="0px" y="0px" viewBox="0 0 64 64" style="enable-background:new 0 0 64 64;" xml:space="preserve" width="64px" height="64px">
<linearGradient id="SVGID_1__48003" gradientUnits="userSpaceOnUse" x1="32" y1="12.6636" x2="32" y2="52.4219" spreadMethod="reflect">
<stop offset="0" style="stop-color:#1A6DFF"/>
<stop offset="1" style="stop-color:#C822FF"/>
</linearGradient>
<path style="fill:url(#SVGID_1__48003);" d="M24.982,51c-1.273,0-2.547-0.475-3.524-1.429L6.888,35.364C6.315,34.806,6,34.061,6,33.268 s0.315-1.538,0.889-2.097l2.82-2.75c1.166-1.137,3.063-1.137,4.228,0.001l10.259,10.003c0.395,0.385,1.058,0.38,1.446-0.012 l24.341-24.526c1.147-1.156,3.044-1.186,4.228-0.068l2.867,2.705c0.582,0.55,0.91,1.29,0.923,2.083 c0.013,0.793-0.291,1.542-0.854,2.109L28.565,49.514C27.584,50.504,26.283,51,24.982,51z M11.822,29.564 c-0.26,0-0.52,0.097-0.717,0.29l-2.82,2.75C8.101,32.783,8,33.018,8,33.268s0.102,0.485,0.285,0.664l14.569,14.208 c1.19,1.163,3.116,1.148,4.291-0.034l28.581-28.798c0.181-0.182,0.277-0.418,0.273-0.668c-0.004-0.25-0.109-0.485-0.296-0.661 l-2.867-2.705c-0.401-0.381-1.047-0.369-1.435,0.022L27.061,39.823c-1.166,1.173-3.079,1.189-4.263,0.034L12.54,29.853 C12.343,29.66,12.083,29.564,11.822,29.564z"/>
<linearGradient id="SVGID_2__48003" gradientUnits="userSpaceOnUse" x1="32.0125" y1="16.8302" x2="32.0125" y2="47.5263" spreadMethod="reflect">
<stop offset="0" style="stop-color:#6DC7FF"/>
<stop offset="1" style="stop-color:#E6ABFF"/>
</linearGradient>
<path style="fill:url(#SVGID_2__48003);" d="M24.977,46.609c-0.489,0-0.98-0.181-1.368-0.544L10.318,33.603l1.367-1.459l13.292,12.461 L52.293,17.29l1.414,1.414L26.391,46.019C26,46.411,25.489,46.609,24.977,46.609z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB