mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
[WIP] theme selector
This commit is contained in:
parent
a7e52809dc
commit
11e164496b
74 changed files with 363 additions and 38 deletions
|
@ -20,6 +20,8 @@ export default Service.extend({
|
|||
ajax: service(),
|
||||
localStorage: service(),
|
||||
kcAuth: service(),
|
||||
assetMap: service('asset-map'),
|
||||
|
||||
appHost: '',
|
||||
apiHost: `${config.apiHost}`,
|
||||
endpoint: `${config.apiHost}/${config.apiNamespace}`,
|
||||
|
@ -41,6 +43,8 @@ export default Service.extend({
|
|||
location: 'selfhost',
|
||||
// for bugfix releases, only admin is made aware of new release and end users see no What's New messaging
|
||||
updateAvailable: false,
|
||||
// empty theme uses default theme
|
||||
theme: '',
|
||||
|
||||
getBaseUrl(endpoint) {
|
||||
return [this.get('endpoint'), endpoint].join('/');
|
||||
|
@ -75,6 +79,9 @@ export default Service.extend({
|
|||
this.set('version', 'v' + this.get('version'));
|
||||
this.set('appHost', window.location.host);
|
||||
|
||||
// Handle theming
|
||||
this.setTheme(this.get('theme'));
|
||||
|
||||
if (requestedRoute === 'secure') {
|
||||
this.setProperties({
|
||||
title: htmlSafe("Secure document viewing"),
|
||||
|
@ -110,5 +117,13 @@ export default Service.extend({
|
|||
|
||||
return response;
|
||||
});
|
||||
},
|
||||
|
||||
setTheme(theme) {
|
||||
theme = theme.trim();
|
||||
if (theme.length === 0) return;
|
||||
|
||||
let file = this.get('assetMap').resolve(`assets/theme-${theme}.css`);
|
||||
$('head').append(`<link rel="stylesheet" href="${file}">`);
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue