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
3db9cf4e
Commit
3db9cf4e
authored
May 02, 2017
by
NGPixel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Pages + Errors localization
parent
69c342f8
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
20 deletions
+20
-20
pages.js
server/controllers/pages.js
+10
-10
error-forbidden.pug
server/views/error-forbidden.pug
+4
-4
error-notexist.pug
server/views/error-notexist.pug
+3
-3
error.pug
server/views/error.pug
+3
-3
No files found.
server/controllers/pages.js
View file @
3db9cf4e
...
...
@@ -31,7 +31,7 @@ router.get('/edit/*', (req, res, next) => {
if
(
pageData
)
{
res
.
render
(
'pages/edit'
,
{
pageData
})
}
else
{
throw
new
Error
(
'Invalid page path.'
)
throw
new
Error
(
lang
.
t
(
'errors:invalidpath'
)
)
}
return
true
}).
catch
((
err
)
=>
{
...
...
@@ -46,7 +46,7 @@ router.put('/edit/*', (req, res, next) => {
if
(
!
res
.
locals
.
rights
.
write
)
{
return
res
.
json
({
ok
:
false
,
error
:
'Forbidden'
error
:
lang
.
t
(
'errors:forbidden'
)
})
}
...
...
@@ -75,7 +75,7 @@ router.get('/create/*', (req, res, next) => {
if
(
_
.
some
([
'create'
,
'edit'
,
'account'
,
'source'
,
'history'
,
'mk'
,
'all'
],
(
e
)
=>
{
return
_
.
startsWith
(
req
.
path
,
'/create/'
+
e
)
}))
{
return
res
.
render
(
'error'
,
{
message
:
'You cannot create a document with this name as it is reserved by the system.'
,
message
:
lang
.
t
(
'errors:reservedname'
)
,
error
:
{}
})
}
...
...
@@ -97,10 +97,10 @@ router.get('/create/*', (req, res, next) => {
return
true
}).
catch
((
err
)
=>
{
winston
.
warn
(
err
)
throw
new
Error
(
'Could not load starter content!'
)
throw
new
Error
(
lang
.
t
(
'errors:starterfailed'
)
)
})
}
else
{
throw
new
Error
(
'This entry already exists!'
)
throw
new
Error
(
lang
.
t
(
'errors:alreadyexists'
)
)
}
}).
catch
((
err
)
=>
{
res
.
render
(
'error'
,
{
...
...
@@ -114,7 +114,7 @@ router.put('/create/*', (req, res, next) => {
if
(
!
res
.
locals
.
rights
.
write
)
{
return
res
.
json
({
ok
:
false
,
error
:
'Forbidden'
error
:
lang
.
t
(
'errors:forbidden'
)
})
}
...
...
@@ -168,7 +168,7 @@ router.get('/source/*', (req, res, next) => {
if
(
pageData
)
{
res
.
render
(
'pages/source'
,
{
pageData
})
}
else
{
throw
new
Error
(
'Invalid page path.'
)
throw
new
Error
(
lang
.
t
(
'errors:invalidpath'
)
)
}
return
true
}).
catch
((
err
)
=>
{
...
...
@@ -189,7 +189,7 @@ router.get('/hist/*', (req, res, next) => {
if
(
pageData
)
{
res
.
render
(
'pages/history'
,
{
pageData
})
}
else
{
throw
new
Error
(
'Invalid page path.'
)
throw
new
Error
(
lang
.
t
(
'errors:invalidpath'
)
)
}
return
true
}).
catch
((
err
)
=>
{
...
...
@@ -240,7 +240,7 @@ router.put('/*', (req, res, next) => {
if
(
!
res
.
locals
.
rights
.
write
)
{
return
res
.
json
({
ok
:
false
,
error
:
'Forbidden'
error
:
lang
.
t
(
'errors:forbidden'
)
})
}
...
...
@@ -249,7 +249,7 @@ router.put('/*', (req, res, next) => {
if
(
_
.
isEmpty
(
req
.
body
.
move
))
{
return
res
.
json
({
ok
:
false
,
error
:
'Invalid document action call.'
error
:
lang
.
t
(
'errors:invalidaction'
)
})
}
...
...
server/views/error-forbidden.pug
View file @
3db9cf4e
...
...
@@ -23,7 +23,7 @@ html(data-logic='error')
body(class='is-forbidden')
.container
a(href='/'): img(src='/images/logo.png')
h1
Forbidden
h2
Sorry, you don't have the necessary permissions to access this page.
a.button.is-amber.is-inverted(href='/')
Go Home
a.button.is-amber.is-inverted(href='/login')
Login as...
h1
= t('errors:forbidden')
h2
= t('errors:forbiddendetail')
a.button.is-amber.is-inverted(href='/')
= t('errors:actions.gohome')
a.button.is-amber.is-inverted(href='/login')
= t('errors:actions.loginas')
server/views/error-notexist.pug
View file @
3db9cf4e
...
...
@@ -24,6 +24,6 @@ html(data-logic='error')
.container
a(href='/'): img(src='/images/logo.png')
h1= message
h2
Would you like to create this entry?
a.button.is-amber.is-inverted.is-featured(href='/create/' + newpath)
Create
a.button.is-amber.is-inverted(href='/')
Go Home
h2
= t('errors:notexistdetail')
a.button.is-amber.is-inverted.is-featured(href='/create/' + newpath)
= t('errors:actions.create')
a.button.is-amber.is-inverted(href='/')
= t('errors:actions.gohome')
server/views/error.pug
View file @
3db9cf4e
...
...
@@ -24,9 +24,9 @@ html(data-logic='error')
.container
a(href='/'): img(src='/images/logo.png')
h1= message
h2
Oops, something went wrong
a.button.is-amber.is-inverted.is-featured(href='/')
Go Home
h2
= t('errors:generic')
a.button.is-amber.is-inverted.is-featured(href='/')
= t('errors:actions.gohome')
if error.stack
h3
Detailed debug trail:
h3
= t('errors:debugmsg')
pre: code #{error.stack}
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