Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wiki-js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
wiki-js
Commits
69748116
Commit
69748116
authored
Jul 13, 2019
by
Nick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: editor locale redirect + welcome page localization
parent
d5466951
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
14 deletions
+58
-14
editor.vue
client/components/editor.vue
+1
-1
common.js
server/controllers/common.js
+3
-1
analytics.graphql
server/graph/schemas/analytics.graphql
+45
-3
fetch-graph-locale.js
server/jobs/fetch-graph-locale.js
+1
-1
login.pug
server/views/legacy/login.pug
+5
-5
page.pug
server/views/legacy/page.pug
+2
-2
welcome.pug
server/views/welcome.pug
+1
-1
No files found.
client/components/editor.vue
View file @
69748116
...
...
@@ -205,7 +205,7 @@ export default {
})
this
.
$store
.
set
(
'editor/id'
,
_
.
get
(
resp
,
'page.id'
))
this
.
$store
.
set
(
'editor/mode'
,
'update'
)
window
.
location
.
assign
(
`/
${
this
.
$store
.
get
(
'page/path'
)}
`
)
window
.
location
.
assign
(
`/
${
this
.
$store
.
get
(
'page/
locale'
)}
/
${
this
.
$store
.
get
(
'page/
path'
)}
`
)
}
else
{
throw
new
Error
(
_
.
get
(
resp
,
'responseResult.message'
))
}
...
...
server/controllers/common.js
View file @
69748116
...
...
@@ -171,6 +171,8 @@ router.get('/*', async (req, res, next) => {
return
res
.
redirect
(
`/
${
pageArgs
.
locale
}
/
${
pageArgs
.
path
}
`
)
}
req
.
i18n
.
changeLanguage
(
pageArgs
.
locale
)
if
(
!
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'read:pages'
],
pageArgs
))
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Unauthorized'
)
return
res
.
status
(
403
).
render
(
'unauthorized'
,
{
action
:
'view'
})
...
...
@@ -206,7 +208,7 @@ router.get('/*', async (req, res, next) => {
}
}
else
if
(
pageArgs
.
path
===
'home'
)
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Welcome'
)
res
.
render
(
'welcome'
)
res
.
render
(
'welcome'
,
{
locale
:
pageArgs
.
locale
}
)
}
else
{
_
.
set
(
res
.
locals
,
'pageMeta.title'
,
'Page Not Found'
)
if
(
WIKI
.
auth
.
checkAccess
(
req
.
user
,
[
'write:pages'
],
pageArgs
))
{
...
...
server/graph/schemas/analytics.graphql
View file @
69748116
...
...
@@ -14,18 +14,32 @@ extend type Mutation {
# QUERIES
# -----------------------------------------------
"""
Queries
for
Analytics
"""
type
AnalyticsQuery
{
"""
Fetch
list
of
Analytics
providers
and
their
configuration
"""
providers
(
"
Return
only
active
providers
"
isEnabled
:
Boolean
):
[
AnalyticsProvider
]
):
[
AnalyticsProvider
]
@
auth
(
requires
:
[
"
manage
:
system
"
])
}
# -----------------------------------------------
# MUTATIONS
# -----------------------------------------------
"""
Mutations
for
Analytics
"""
type
AnalyticsMutation
{
"""
Update
a
list
of
Analytics
providers
and
their
configuration
"""
updateProviders
(
"
List
of
providers
"
providers
:
[
AnalyticsProviderInput
]!
):
DefaultResponse
@
auth
(
requires
:
[
"
manage
:
system
"
])
}
...
...
@@ -34,20 +48,48 @@ type AnalyticsMutation {
# TYPES
# -----------------------------------------------
"""
Analytics
Provider
"""
type
AnalyticsProvider
{
"
Is
the
provider
active
"
isEnabled
:
Boolean
!
"
Unique
identifier
for
this
provider
"
key
:
String
!
"
List
of
configuration
properties
,
formatted
as
stringified
JSON
objects
"
props
:
[
String
]
"
Name
of
the
provider
"
title
:
String
!
"
Short
description
of
the
provider
"
description
:
String
"
Is
the
provider
available
for
use
"
isAvailable
:
Boolean
"
Path
to
the
provider
logo
"
logo
:
String
"
Website
of
the
provider
"
website
:
String
icon
:
String
config
:
[
KeyValuePair
]
@
auth
(
requires
:
[
"
manage
:
system
"
])
"
Configuration
values
for
this
provider
"
config
:
[
KeyValuePair
]
}
"""
Analytics
Configuration
Input
"""
input
AnalyticsProviderInput
{
"
Is
the
provider
active
"
isEnabled
:
Boolean
!
"
Unique
identifier
of
the
provider
"
key
:
String
!
"
Configuration
values
for
this
provider
"
config
:
[
KeyValuePairInput
]
}
server/jobs/fetch-graph-locale.js
View file @
69748116
...
...
@@ -37,7 +37,7 @@ module.exports = async (localeCode) => {
const
locales
=
await
WIKI
.
cache
.
get
(
'locales'
)
if
(
locales
)
{
const
currentLocale
=
_
.
find
(
locales
,
[
'code'
,
localeCode
])
||
{}
const
existingLocale
=
await
WIKI
.
models
.
locales
.
query
().
where
(
'code'
,
localeCode
)
const
existingLocale
=
await
WIKI
.
models
.
locales
.
query
().
where
(
'code'
,
localeCode
)
.
first
()
if
(
existingLocale
)
{
await
WIKI
.
models
.
locales
.
query
().
patch
({
strings
:
lcObj
...
...
server/views/legacy/login.pug
View file @
69748116
...
...
@@ -2,7 +2,7 @@ extends master.pug
block body
#root
.login-deprecated
Your browser is outdated. Upgrade to a #[a(href='https://bestvpn.org/outdatedbrowser/en', rel='nofollow') modern browser].
.login-deprecated
!= t('outdatedBrowserWarning', { modernBrowser: '<a href="https://bestvpn.org/outdatedbrowser/en" rel="nofollow">' + t('modernBrowser') + '</a>', interpolation: { escapeValue: false } })
.login
.login-dialog
if err
...
...
@@ -12,12 +12,12 @@ block body
select(name='strategy')
each str in formStrategies
option(value=str.key, selected)= str.title
input(type='text', name='user', placeholder=
'Username / Email'
)
input(type='password', name='pass', placeholder=
'Password'
)
button(type='submit')
Login
input(type='text', name='user', placeholder=
t('auth:fields.emailUser')
)
input(type='password', name='pass', placeholder=
t('auth:fields.password')
)
button(type='submit')
= t('auth:actions.login')
if socialStrategies.length
.login-social
h2
or login using...
h2
= t('auth:orLoginUsingStrategy')
each str in socialStrategies
a.login-social-icon(href='/login/' + str.key, class=str.color)
!= str.icon
server/views/legacy/page.pug
View file @
69748116
...
...
@@ -10,7 +10,7 @@ block body
#root
.header
span.header-title= siteConfig.title
span.header-deprecated
Your browser is outdated. Upgrade to a #[a(href='https://bestvpn.org/outdatedbrowser/en', rel='nofollow') modern browser].
span.header-deprecated
!= t('outdatedBrowserWarning', { modernBrowser: '<a href="https://bestvpn.org/outdatedbrowser/en" rel="nofollow">' + t('modernBrowser') + '</a>', interpolation: { escapeValue: false } })
span.header-login
if !isAuthenticated
a(href='/login', title='Login')
...
...
@@ -43,7 +43,7 @@ block body
div!= page.render
if page.toc.length
.toc
.toc-title
Table of Contents
.toc-title
= t('page.toc')
each tocItem, tocIdx in page.toc
a.toc-tile(href='#' + tocItem.anchor)
i.material-icons arrow_right
...
...
server/views/welcome.pug
View file @
69748116
...
...
@@ -8,6 +8,6 @@ block body
img.animated.fadeIn(src='/svg/logo-wikijs.svg', alt='Wiki.js')
.headline= t('welcome.title')
.subheading.mt-3= t('welcome.subtitle')
v-btn.mt-5(color='primary', href='/e/home', large)
v-btn.mt-5(color='primary', href='/e/
' + locale + '/
home', large)
v-icon(left) add
span= t('welcome.createhome')
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment