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
fc42fd21
Commit
fc42fd21
authored
Jul 02, 2017
by
NGPixel
Committed by
Nicolas Giard
Jul 09, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: Color Theme live preview
parent
06b49e03
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
71 additions
and
5 deletions
+71
-5
app.js
client/js/app.js
+9
-1
index.js
client/js/helpers/index.js
+0
-1
lodash.js
client/js/helpers/lodash.js
+3
-1
admin-theme.component.js
client/js/pages/admin-theme.component.js
+11
-0
footer.scss
client/scss/components/footer.scss
+1
-0
nav.scss
client/scss/components/nav.scss
+1
-0
sidebar.scss
client/scss/components/sidebar.scss
+2
-0
data.yml
server/app/data.yml
+20
-0
admin.js
server/controllers/admin.js
+22
-0
footer.pug
server/views/common/footer.pug
+1
-1
header.pug
server/views/common/header.pug
+1
-1
No files found.
client/js/app.js
View file @
fc42fd21
...
@@ -22,6 +22,7 @@ import 'jquery-sticky'
...
@@ -22,6 +22,7 @@ import 'jquery-sticky'
// ====================================
// ====================================
import
helpers
from
'./helpers'
import
helpers
from
'./helpers'
import
_
from
'./helpers/lodash'
// ====================================
// ====================================
// Load Vue Components
// Load Vue Components
...
@@ -62,7 +63,7 @@ import sourceViewComponent from './pages/source-view.component.js'
...
@@ -62,7 +63,7 @@ import sourceViewComponent from './pages/source-view.component.js'
Vue
.
use
(
VueResource
)
Vue
.
use
(
VueResource
)
Vue
.
use
(
VueClipboards
)
Vue
.
use
(
VueClipboards
)
Vue
.
use
(
VueI18Next
)
Vue
.
use
(
VueI18Next
)
Vue
.
use
(
VueLodash
,
helpers
.
_
)
Vue
.
use
(
VueLodash
,
_
)
Vue
.
use
(
helpers
)
Vue
.
use
(
helpers
)
// ====================================
// ====================================
...
@@ -142,6 +143,13 @@ $(() => {
...
@@ -142,6 +143,13 @@ $(() => {
store
,
store
,
i18n
,
i18n
,
el
:
'#root'
,
el
:
'#root'
,
methods
:
{
changeTheme
(
opts
)
{
this
.
$el
.
className
=
`has-stickynav is-primary-
${
opts
.
primary
}
is-alternate-
${
opts
.
alt
}
`
this
.
$refs
.
header
.
className
=
`nav is-
${
opts
.
primary
}
`
this
.
$refs
.
footer
.
className
=
`footer is-
${
opts
.
footer
}
`
}
},
mounted
()
{
mounted
()
{
$
(
'a:not(.toc-anchor)'
).
smoothScroll
({
speed
:
500
,
offset
:
-
50
})
$
(
'a:not(.toc-anchor)'
).
smoothScroll
({
speed
:
500
,
offset
:
-
50
})
$
(
'#header'
).
sticky
({
topSpacing
:
0
})
$
(
'#header'
).
sticky
({
topSpacing
:
0
})
...
...
client/js/helpers/index.js
View file @
fc42fd21
'use strict'
'use strict'
const
helpers
=
{
const
helpers
=
{
_
:
require
(
'./lodash'
),
common
:
require
(
'./common'
),
common
:
require
(
'./common'
),
form
:
require
(
'./form'
),
form
:
require
(
'./form'
),
pages
:
require
(
'./pages'
)
pages
:
require
(
'./pages'
)
...
...
client/js/helpers/lodash.js
View file @
fc42fd21
...
@@ -27,6 +27,7 @@ import reject from 'lodash/reject'
...
@@ -27,6 +27,7 @@ import reject from 'lodash/reject'
import
slice
from
'lodash/slice'
import
slice
from
'lodash/slice'
import
split
from
'lodash/split'
import
split
from
'lodash/split'
import
startCase
from
'lodash/startCase'
import
startCase
from
'lodash/startCase'
import
startsWith
from
'lodash/startsWith'
import
toString
from
'lodash/toString'
import
toString
from
'lodash/toString'
import
toUpper
from
'lodash/toUpper'
import
toUpper
from
'lodash/toUpper'
import
trim
from
'lodash/trim'
import
trim
from
'lodash/trim'
...
@@ -35,7 +36,7 @@ import trim from 'lodash/trim'
...
@@ -35,7 +36,7 @@ import trim from 'lodash/trim'
// Build lodash object
// Build lodash object
// ====================================
// ====================================
export
default
{
module
.
exports
=
{
deburr
,
deburr
,
concat
,
concat
,
cloneDeep
,
cloneDeep
,
...
@@ -59,6 +60,7 @@ export default {
...
@@ -59,6 +60,7 @@ export default {
slice
,
slice
,
split
,
split
,
startCase
,
startCase
,
startsWith
,
toString
,
toString
,
toUpper
,
toUpper
,
trim
trim
...
...
client/js/pages/admin-theme.component.js
View file @
fc42fd21
...
@@ -12,6 +12,17 @@ export default {
...
@@ -12,6 +12,17 @@ export default {
codecolorize
:
'true'
codecolorize
:
'true'
}
}
},
},
watch
:
{
primary
(
val
)
{
this
.
$root
.
changeTheme
(
this
.
$data
)
},
alt
(
val
)
{
this
.
$root
.
changeTheme
(
this
.
$data
)
},
footer
(
val
)
{
this
.
$root
.
changeTheme
(
this
.
$data
)
}
},
methods
:
{
methods
:
{
saveTheme
()
{
saveTheme
()
{
let
self
=
this
let
self
=
this
...
...
client/scss/components/footer.scss
View file @
fc42fd21
...
@@ -12,6 +12,7 @@
...
@@ -12,6 +12,7 @@
right
:
0
;
right
:
0
;
bottom
:
0
;
bottom
:
0
;
left
:
0
;
left
:
0
;
transition
:
background-color
1s
ease
;
ul
{
ul
{
padding
:
0
;
padding
:
0
;
...
...
client/scss/components/nav.scss
View file @
fc42fd21
...
@@ -9,6 +9,7 @@
...
@@ -9,6 +9,7 @@
box-shadow
:
0
2px
3px
rgba
(
mc
(
$primary
,
'500'
)
,
0
.2
);
box-shadow
:
0
2px
3px
rgba
(
mc
(
$primary
,
'500'
)
,
0
.2
);
z-index
:
2
;
z-index
:
2
;
color
:
#FFF
;
color
:
#FFF
;
transition
:
background-color
1s
ease
;
/* THEME OVERRIDE - START */
/* THEME OVERRIDE - START */
...
...
client/scss/components/sidebar.scss
View file @
fc42fd21
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
width
:
250px
;
width
:
250px
;
max-width
:
250px
;
max-width
:
250px
;
min-height
:
calc
(
100vh
-
120px
);
min-height
:
calc
(
100vh
-
120px
);
transition
:
background-color
1s
ease
;
aside
{
aside
{
padding
:
1px
0
15px
0
;
padding
:
1px
0
15px
0
;
...
@@ -23,6 +24,7 @@
...
@@ -23,6 +24,7 @@
margin
:
0
0
15px
0
;
margin
:
0
0
15px
0
;
text-align
:
center
;
text-align
:
center
;
box-shadow
:
0
0
5px
rgba
(
0
,
0
,
0
,
0
.3
);
box-shadow
:
0
0
5px
rgba
(
0
,
0
,
0
,
0
.3
);
transition
:
background-color
1s
ease
;
i
{
i
{
margin-right
:
5px
;
margin-right
:
5px
;
...
...
server/app/data.yml
View file @
fc42fd21
...
@@ -64,6 +64,26 @@ defaults:
...
@@ -64,6 +64,26 @@ defaults:
code
:
code
:
dark
:
true
dark
:
true
colorize
:
true
colorize
:
true
colors
:
-
red
-
pink
-
purple
-
deep-purple
-
indigo
-
blue
-
light-blue
-
cyan
-
teal
-
green
-
light-green
-
lime
-
yellow
-
amber
-
orange
-
deep-orange
-
brown
-
grey
-
blue-grey
langs
:
langs
:
-
-
id
:
en
id
:
en
...
...
server/controllers/admin.js
View file @
fc42fd21
...
@@ -271,4 +271,26 @@ router.get('/theme', (req, res) => {
...
@@ -271,4 +271,26 @@ router.get('/theme', (req, res) => {
res
.
render
(
'pages/admin/theme'
,
{
adminTab
:
'theme'
})
res
.
render
(
'pages/admin/theme'
,
{
adminTab
:
'theme'
})
})
})
router
.
post
(
'/theme'
,
(
req
,
res
)
=>
{
if
(
res
.
locals
.
isGuest
)
{
return
res
.
render
(
'error-forbidden'
)
}
if
(
!
validator
.
isIn
(
req
.
body
.
primary
,
appdata
.
colors
))
{
return
res
.
status
(
406
).
json
({
msg
:
'Primary color is invalid.'
})
}
else
if
(
!
validator
.
isIn
(
req
.
body
.
alt
,
appdata
.
colors
))
{
return
res
.
status
(
406
).
json
({
msg
:
'Alternate color is invalid.'
})
}
else
if
(
!
validator
.
isIn
(
req
.
body
.
footer
,
appdata
.
colors
))
{
return
res
.
status
(
406
).
json
({
msg
:
'Footer color is invalid.'
})
}
appconfig
.
theme
.
primary
=
req
.
body
.
primary
appconfig
.
theme
.
alt
=
req
.
body
.
alt
appconfig
.
theme
.
footer
=
req
.
body
.
footer
appconfig
.
theme
.
code
.
dark
=
req
.
body
.
codedark
===
'true'
appconfig
.
theme
.
code
.
colorize
=
req
.
body
.
codecolorize
===
'true'
return
res
.
json
({
msg
:
'OK'
})
})
module
.
exports
=
router
module
.
exports
=
router
server/views/common/footer.pug
View file @
fc42fd21
footer.footer(class=['is-' + appconfig.theme.footer])
footer.footer(class=['is-' + appconfig.theme.footer]
, ref='footer'
)
span
span
= t('footer.poweredby') + ' '
= t('footer.poweredby') + ' '
a(href='https://github.com/Requarks/wiki') Wiki.js
a(href='https://github.com/Requarks/wiki') Wiki.js
...
...
server/views/common/header.pug
View file @
fc42fd21
#header-container
#header-container
nav.nav#header(class=['is-' + appconfig.theme.primary])
nav.nav#header(class=['is-' + appconfig.theme.primary]
, ref='header'
)
.nav-left
.nav-left
block rootNavLeft
block rootNavLeft
a.nav-item(href='/')
a.nav-item(href='/')
...
...
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