mirror of
https://github.com/documize/community.git
synced 2025-07-24 15:49:44 +02:00
[WIP] User can select theme
This commit is contained in:
parent
11e164496b
commit
679049d2b1
11 changed files with 141 additions and 8 deletions
|
@ -120,10 +120,22 @@ export default Service.extend({
|
|||
},
|
||||
|
||||
setTheme(theme) {
|
||||
theme = theme.trim();
|
||||
if (theme.length === 0) return;
|
||||
$('#theme-link').remove();
|
||||
|
||||
theme = theme.toLowerCase().replace(' ', '-').replace('default', '').trim();
|
||||
if (theme.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
let file = this.get('assetMap').resolve(`assets/theme-${theme}.css`);
|
||||
$('head').append(`<link rel="stylesheet" href="${file}">`);
|
||||
$('head').append(`<link id="theme-link" rel="stylesheet" href="${file}">`);
|
||||
},
|
||||
|
||||
getThemes() {
|
||||
return this.get('ajax').request(`public/meta/themes`, {
|
||||
method: 'GET'
|
||||
}).then((response) => {
|
||||
return response;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue