fix: code linting

pull/1066/head
Nick 5 years ago
parent 7634bd266d
commit 69e644e18f

@ -41,13 +41,17 @@
v-list-item-title.body-2 {{$t('common:header.edit')}}
v-list-item.pl-4(@click='pageHistory', v-if='mode !== `history`')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-history
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.history')}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.history')}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-list-item.pl-4(@click='pageSource', v-if='mode !== `source`')
v-list-item-avatar(size='24'): v-icon(color='indigo') mdi-code-tags
v-list-item-title.body-2 {{$t('common:header.viewSource')}}
v-list-item.pl-4(@click='pageMove', v-if='isAuthenticated')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-content-save-move-outline
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.move')}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.move')}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-list-item.pl-4(@click='pageDelete', v-if='isAuthenticated')
v-list-item-avatar(size='24'): v-icon(color='red darken-2') mdi-trash-can-outline
v-list-item-title.body-2 {{$t('common:header.delete')}}
@ -55,7 +59,9 @@
.overline.pa-4.grey--text {{$t('common:header.assets')}}
v-list-item.pl-4(@click='assets')
v-list-item-avatar(size='24'): v-icon(color='grey lighten-2') mdi-folder-multiple-image
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.imagesFiles')}}
v-list-item-content
v-list-item-title.body-2.grey--text.text--ligten-2 {{$t('common:header.imagesFiles')}}
v-list-item-subtitle.overline.grey--text.text--lighten-2 Coming soon
v-toolbar-title(:class='{ "mx-2": $vuetify.breakpoint.mdAndUp, "mx-0": $vuetify.breakpoint.smAndDown }')
span.subheading {{title}}
v-flex(md4, v-if='$vuetify.breakpoint.mdAndUp')
@ -150,12 +156,11 @@
v-btn(icon, v-on='{ ...menu, ...tooltip }', :class='$vuetify.rtl ? `ml-3` : ``')
v-icon(color='grey') mdi-web
span {{$t('common:header.language')}}
v-list.py-0
v-list(nav)
template(v-for='(lc, idx) of locales')
v-list-item(@click='changeLocale(lc)')
v-list-item-action: v-chip(:color='lc.code === locale ? `blue` : `grey`', small, label, dark) {{lc.code.toUpperCase()}}
v-list-item-title {{lc.name}}
v-divider.my-0(v-if='idx < locales.length - 1')
v-tooltip(bottom, v-if='isAuthenticated && isAdmin')
template(v-slot:activator='{ on }')
v-btn.btn-animate-rotate(icon, href='/a', v-on='on', :class='$vuetify.rtl ? `ml-3` : ``')
@ -170,7 +175,7 @@
v-avatar(v-else-if='picture.kind === `image`', :size='34')
v-img(:src='picture.url')
span {{$t('common:header.account')}}
v-list.py-0
v-list(nav)
v-list-item.py-3.grey(:class='$vuetify.theme.dark ? `darken-4-l5` : `lighten-5`')
v-list-item-avatar
v-avatar.blue(v-if='picture.kind === `initials`', :size='40')
@ -180,18 +185,19 @@
v-list-item-content
v-list-item-title {{name}}
v-list-item-subtitle {{email}}
v-divider.my-0
v-list-item(href='/w', disabled)
v-list-item-action: v-icon(color='blue') mdi-view-compact-outline
v-list-item-title {{$t('common:header.myWiki')}}
v-divider.my-0
v-list-item-content
v-list-item-title {{$t('common:header.myWiki')}}
v-list-item-subtitle.overline Coming soon
v-list-item(href='/p', disabled)
v-list-item-action: v-icon(color='blue') mdi-face-profile
v-list-item-title {{$t('common:header.profile')}}
v-divider.my-0
v-list-item-content
v-list-item-title {{$t('common:header.profile')}}
v-list-item-subtitle.overline Coming soon
v-list-item(@click='logout')
v-list-item-action: v-icon(color='red') mdi-logout
v-list-item-title {{$t('common:header.logout')}}
v-list-item-title.red--text {{$t('common:header.logout')}}
v-tooltip(v-else, left)
template(v-slot:activator='{ on }')

@ -319,21 +319,21 @@ export default {
})
}, 500),
onCmPaste (cm, ev) {
const clipItems = (ev.clipboardData || ev.originalEvent.clipboardData).items
for (let clipItem of clipItems) {
if (_.startsWith(clipItem.type, 'image/')) {
const file = clipItem.getAsFile()
const reader = new FileReader()
reader.onload = evt => {
this.$store.commit(`loadingStart`, 'editor-paste-image')
this.insertAfter({
content: `![${file.name}](${evt.target.result})`,
newLine: true
})
}
reader.readAsDataURL(file)
}
}
// const clipItems = (ev.clipboardData || ev.originalEvent.clipboardData).items
// for (let clipItem of clipItems) {
// if (_.startsWith(clipItem.type, 'image/')) {
// const file = clipItem.getAsFile()
// const reader = new FileReader()
// reader.onload = evt => {
// this.$store.commit(`loadingStart`, 'editor-paste-image')
// this.insertAfter({
// content: `![${file.name}](${evt.target.result})`,
// newLine: true
// })
// }
// reader.readAsDataURL(file)
// }
// }
},
/**
* Update cursor state

@ -1,79 +1,79 @@
/**
* Placeholder attribute for inputs
*
* @return {string} Placeholder attributes
*/
* Placeholder attribute for inputs
*
* @return {string} Placeholder attributes
*/
@mixin placeholder {
&::-webkit-input-placeholder {@content};
&::-moz-placeholder {@content}
&:-ms-input-placeholder {@content}
&:placeholder-shown {@content};
&::-webkit-input-placeholder {@content;}
&::-moz-placeholder {@content;}
&:-ms-input-placeholder {@content;}
&:placeholder-shown {@content;}
}
/**
* Spinner element
*
* @param {string} $color - Color
* @param {string} $dur - Animation Duration
* @param {int} $width - Width
* @param {int} $height [$width] - height
*
* @return {string} Spinner element
*/
* Spinner element
*
* @param {string} $color - Color
* @param {string} $dur - Animation Duration
* @param {int} $width - Width
* @param {int} $height [$width] - height
*
* @return {string} Spinner element
*/
@mixin spinner($color,$dur,$width,$height:$width) {
width: $width;
height: $height;
border-radius: 50%;
box-shadow:0 0 0 1px rgba(0,0,0,0.1), 2px 1px 0 $color;
@include prefix(animation, spin $dur linear infinite);
@include keyframes(spin) {
100%{
@include prefix(transform, rotate(360deg));
}
};
width: $width;
height: $height;
border-radius: 50%;
box-shadow: 0 0 0 1px rgba(0,0,0,0.1), 2px 1px 0 $color;
@include prefix(animation, spin $dur linear infinite);
@include keyframes(spin) {
100%{
@include prefix(transform, rotate(360deg));
}
}
}
/**
* Prefixes for keyframes
*
* @param {string} $animation-name - The animation name
*
* @return {string} Prefixed keyframes attributes
*/
* Prefixes for keyframes
*
* @param {string} $animation-name - The animation name
*
* @return {string} Prefixed keyframes attributes
*/
@mixin keyframes($animation-name) {
@-webkit-keyframes #{$animation-name} {
@content;
}
@-moz-keyframes #{$animation-name} {
@content;
}
@-o-keyframes #{$animation-name} {
@content;
}
@keyframes #{$animation-name} {
@content;
}
@-webkit-keyframes #{$animation-name} {
@content;
}
@-moz-keyframes #{$animation-name} {
@content;
}
@-o-keyframes #{$animation-name} {
@content;
}
@keyframes #{$animation-name} {
@content;
}
}
/**
* Prefix function for browser compatibility
*
* @param {string} $property - Property name
* @param {any} $value - Property value
*
* @return {string} Prefixed attributes
*/
* Prefix function for browser compatibility
*
* @param {string} $property - Property name
* @param {any} $value - Property value
*
* @return {string} Prefixed attributes
*/
@mixin prefix($property, $value) {
-webkit-#{$property}: #{$value};
-moz-#{$property}: #{$value};
-ms-#{$property}: #{$value};
-o-#{$property}: #{$value};
#{$property}: #{$value};
-webkit-#{$property}: #{$value};
-moz-#{$property}: #{$value};
-ms-#{$property}: #{$value};
-o-#{$property}: #{$value};
#{$property}: #{$value};
}
/**
* Layout Mixins
*/
* Layout Mixins
*/
@mixin from($device) {
@media screen and (min-width: $device) {
@content;

@ -18,11 +18,11 @@ export default {
state,
mutations: {
...make.mutations(state),
pushMediaFolderTree: (state, folder) => {
state.media.folderTree = state.media.folderTree.concat(folder)
pushMediaFolderTree: (st, folder) => {
st.media.folderTree = st.media.folderTree.concat(folder)
},
popMediaFolderTree: (state) => {
state.media.folderTree = state.media.folderTree.slice(0, -1)
popMediaFolderTree: (st) => {
st.media.folderTree = st.media.folderTree.slice(0, -1)
}
}
}

@ -33,24 +33,24 @@ export default new Vuex.Store({
},
mutations: {
...make.mutations(state),
loadingStart (state, stackName) {
state.loadingStack = _.union(state.loadingStack, [stackName])
loadingStart (st, stackName) {
st.loadingStack = _.union(st.loadingStack, [stackName])
},
loadingStop (state, stackName) {
state.loadingStack = _.without(state.loadingStack, stackName)
loadingStop (st, stackName) {
st.loadingStack = _.without(st.loadingStack, stackName)
},
showNotification (state, opts) {
state.notification = _.defaults(opts, {
showNotification (st, opts) {
st.notification = _.defaults(opts, {
message: '',
style: 'primary',
icon: 'cached',
isActive: true
})
},
updateNotificationState (state, newState) {
state.notification.isActive = newState
updateNotificationState (st, newState) {
st.notification.isActive = newState
},
pushGraphError (state, err) {
pushGraphError (st, err) {
WIKI.$store.commit('showNotification', {
style: 'red',
message: _.get(err, 'graphQLErrors[0].message', err.message),

@ -20,21 +20,21 @@ export default {
state,
mutations: {
...make.mutations(state),
REFRESH_AUTH(state) {
REFRESH_AUTH(st) {
const jwtCookie = Cookies.get('jwt')
if (jwtCookie) {
try {
const jwtData = jwt.decode(jwtCookie)
state.id = jwtData.id
state.email = jwtData.email
state.name = jwtData.name
state.pictureUrl = jwtData.pictureUrl
state.localeCode = jwtData.localeCode
state.defaultEditor = jwtData.defaultEditor
state.permissions = jwtData.permissions
state.iat = jwtData.iat
state.exp = jwtData.exp
state.authenticated = true
st.id = jwtData.id
st.email = jwtData.email
st.name = jwtData.name
st.pictureUrl = jwtData.pictureUrl
st.localeCode = jwtData.localeCode
st.defaultEditor = jwtData.defaultEditor
st.permissions = jwtData.permissions
st.iat = jwtData.iat
st.exp = jwtData.exp
st.authenticated = true
} catch (err) {
console.debug('Invalid JWT. Silent authentication skipped.')
}

@ -78,21 +78,27 @@
color='teal lighten-5'
v-for='(tag, idx) in tags'
:href='`/t/` + tag.tag'
:key='tag.tag'
:key='`tag-` + tag.tag'
)
v-icon(color='teal', left, small) mdi-label
v-icon(color='teal', left, small) mdi-tag
span.teal--text.text--darken-2 {{tag.title}}
v-chip.mr-1(
label
color='teal lighten-5'
:href='`/t/` + tags.map(t => t.tag).join(`/`)'
)
v-icon(color='teal', size='20') mdi-tag-multiple
v-card.mb-5
.pa-5
.overline.indigo--text.d-flex.align-center(:class='$vuetify.theme.dark ? `text--lighten-3` : ``')
span {{$t('common:page.lastEditedBy')}}
v-spacer
v-tooltip(top, v-if='isAuthenticated')
template(v-slot:activator='{ on }')
v-btn.btn-animate-edit(icon, :href='"/h/" + locale + "/" + path', v-on='on', x-small)
v-icon(color='grey', dense) mdi-history
span History
//- v-spacer
//- v-tooltip(top, v-if='isAuthenticated')
//- template(v-slot:activator='{ on }')
//- v-btn.btn-animate-edit(icon, :href='"/h/" + locale + "/" + path', v-on='on', x-small)
//- v-icon(color='grey', dense) mdi-history
//- span History
.body-2.grey--text(:class='darkMode ? `` : `text--darken-3`') {{ authorName }}
.caption.grey--text.text--darken-1 {{ updatedAt | moment('calendar') }}

@ -120,8 +120,8 @@ module.exports = {
} else {
res.cookie('jwt', newToken.token, { expires: moment().add(365, 'days').toDate() })
}
} catch (err) {
WIKI.logger.warn(err)
} catch (errc) {
WIKI.logger.warn(errc)
return next()
}
}
@ -137,8 +137,8 @@ module.exports = {
}
// JWT is valid
req.logIn(user, { session: false }, (err) => {
if (err) { return next(err) }
req.logIn(user, { session: false }, (errc) => {
if (errc) { return next(errc) }
next()
})
})(req, res, next)

@ -45,8 +45,8 @@ module.exports = {
_.set(lcObj, key.replace(':', '.'), value)
})
const localeExists = await WIKI.models.locales.query().select('code').where('code', locale.code).first()
if (localeExists) {
const localeDbExists = await WIKI.models.locales.query().select('code').where('code', locale.code).first()
if (localeDbExists) {
await WIKI.models.locales.query().update({
code: locale.code,
strings: lcObj,

@ -71,8 +71,8 @@ module.exports = {
}))
resolve(true)
} catch (err) {
reject(err)
} catch (errc) {
reject(errc)
}
db.close()
})

@ -291,8 +291,8 @@ module.exports = class User extends Model {
mustChangePwd: true,
continuationToken: pwdChangeToken
})
} catch (err) {
WIKI.logger.warn(err)
} catch (errc) {
WIKI.logger.warn(errc)
return reject(new WIKI.Error.AuthGenericError())
}
}
@ -308,14 +308,14 @@ module.exports = class User extends Model {
tfaRequired: true,
continuationToken: tfaToken
})
} catch (err) {
WIKI.logger.warn(err)
} catch (errc) {
WIKI.logger.warn(errc)
return reject(new WIKI.Error.AuthGenericError())
}
}
context.req.logIn(user, { session: !strInfo.useForm }, async err => {
if (err) { return reject(err) }
context.req.logIn(user, { session: !strInfo.useForm }, async errc => {
if (errc) { return reject(errc) }
const jwtToken = await WIKI.models.users.refreshToken(user)
resolve({ jwt: jwtToken.token })
})

@ -31,22 +31,22 @@ module.exports = {
builder.andWhere('path', 'like', `${opts.path}%`)
}
// TODO: Add user permissions filtering
builder.andWhere(builder => {
builder.andWhere(builderSub => {
switch (WIKI.config.db.type) {
case 'postgres':
builder.where('title', 'ILIKE', `%${q}%`)
builder.orWhere('description', 'ILIKE', `%${q}%`)
builderSub.where('title', 'ILIKE', `%${q}%`)
builderSub.orWhere('description', 'ILIKE', `%${q}%`)
break
case 'mysql':
case 'mariadb':
builder.whereRaw(`title LIKE '%?%' COLLATE utf8_general_ci`, [q])
builder.orWhereRaw(`description LIKE '%?%' COLLATE utf8_general_ci`, [q])
builderSub.whereRaw(`title LIKE '%?%' COLLATE utf8_general_ci`, [q])
builderSub.orWhereRaw(`description LIKE '%?%' COLLATE utf8_general_ci`, [q])
break
// TODO: MSSQL handling
default:
builder.where('title', 'LIKE', `%${q}%`)
builder.orWhere('description', 'LIKE', `%${q}%`)
builderSub.where('title', 'LIKE', `%${q}%`)
builderSub.orWhere('description', 'LIKE', `%${q}%`)
break
}
})

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save