Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pleroma
pleroma-fe
Commits
1d64b762
Commit
1d64b762
authored
Feb 14, 2017
by
lain
Browse files
Add basic configuration module, make it work for title and theme.
parent
340b2147
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/App.js
View file @
1d64b762
...
...
@@ -16,7 +16,8 @@ export default {
}),
computed
:
{
currentUser
()
{
return
this
.
$store
.
state
.
users
.
currentUser
},
style
()
{
return
{
'
background-image
'
:
`url(
${
this
.
currentUser
.
background_image
}
)`
}
}
style
()
{
return
{
'
background-image
'
:
`url(
${
this
.
currentUser
.
background_image
}
)`
}
},
sitename
()
{
return
this
.
$store
.
state
.
config
.
name
}
},
methods
:
{
activatePanel
(
panelName
)
{
...
...
src/App.vue
View file @
1d64b762
...
...
@@ -3,7 +3,7 @@
<nav
class=
'container base01-background base04'
>
<div
class=
'inner-nav'
>
<div
class=
'item'
>
<a
route-to=
'friends-timeline'
href=
"#"
>
Pleroma FE
</a>
<a
route-to=
'friends-timeline'
href=
"#"
>
{{
sitename
}}
</a>
</div>
<style
-switcher
></style-switcher>
</div>
...
...
src/components/style_switcher/style_switcher.js
View file @
1d64b762
import
StyleSetter
from
'
../../services/style_setter/style_setter.js
'
export
default
{
data
:
()
=>
({
availableStyles
:
[],
...
...
@@ -13,8 +11,7 @@ export default {
},
watch
:
{
selected
()
{
const
fullPath
=
`/static/css/
${
this
.
selected
}
`
StyleSetter
.
setStyle
(
fullPath
)
this
.
$store
.
dispatch
(
'
setOption
'
,
{
name
:
'
theme
'
,
value
:
this
.
selected
})
}
}
}
src/main.js
View file @
1d64b762
...
...
@@ -12,11 +12,10 @@ import UserProfile from './components/user_profile/user_profile.vue'
import
statusesModule
from
'
./modules/statuses.js
'
import
usersModule
from
'
./modules/users.js
'
import
apiModule
from
'
./modules/api.js
'
import
configModule
from
'
./modules/config.js
'
import
VueTimeago
from
'
vue-timeago
'
import
StyleSetter
from
'
./services/style_setter/style_setter.js
'
Vue
.
use
(
Vuex
)
Vue
.
use
(
VueRouter
)
Vue
.
use
(
VueTimeago
,
{
...
...
@@ -30,7 +29,8 @@ const store = new Vuex.Store({
modules
:
{
statuses
:
statusesModule
,
users
:
usersModule
,
api
:
apiModule
api
:
apiModule
,
config
:
configModule
}
})
...
...
@@ -61,4 +61,9 @@ new Vue({
components
:
{
App
}
})
StyleSetter
.
setStyle
(
'
/static/css/base16-solarized-light.css
'
)
window
.
fetch
(
'
/static/config.json
'
)
.
then
((
res
)
=>
res
.
json
())
.
then
(({
name
,
theme
})
=>
{
store
.
dispatch
(
'
setOption
'
,
{
name
:
'
name
'
,
value
:
name
})
store
.
dispatch
(
'
setOption
'
,
{
name
:
'
theme
'
,
value
:
theme
})
})
src/modules/config.js
0 → 100644
View file @
1d64b762
import
{
set
}
from
'
vue
'
import
StyleSetter
from
'
../services/style_setter/style_setter.js
'
const
defaultState
=
{
name
:
'
Pleroma FE
'
}
const
config
=
{
state
:
defaultState
,
mutations
:
{
setOption
(
state
,
{
name
,
value
})
{
set
(
state
,
name
,
value
)
}
},
actions
:
{
setOption
({
commit
},
{
name
,
value
})
{
commit
(
'
setOption
'
,
{
name
,
value
})
switch
(
name
)
{
case
'
name
'
:
document
.
title
=
value
break
case
'
theme
'
:
const
fullPath
=
`/static/css/
${
value
}
`
StyleSetter
.
setStyle
(
fullPath
)
}
}
}
}
export
default
config
static/config.json
0 → 100644
View file @
1d64b762
{
"name"
:
"Pleroma FE"
,
"theme"
:
"base16-ashes.css"
}
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