gerrit: update OpenDev theme CSS installation

registerStyleModule has been deprecated for a few releases, and is
removed in 3.8.  This inserts the style element directly, as suggested
by the Gerrit plugin documentation [1].

[1] https://gerrit-documentation.storage.googleapis.com/Documentation/3.7.2/pg-plugin-dev.html#low-level-style

Change-Id: I23600754dc35a9d455e611ac25a6162b2e973a03
This commit is contained in:
Ian Wienand 2023-04-27 11:56:20 +10:00
parent 276396babc
commit 7b6125aace
No known key found for this signature in database
1 changed files with 12 additions and 18 deletions

View File

@ -17,23 +17,17 @@
'use strict';
const openDevThemeStyle = document.createElement('dom-module');
openDevThemeStyle.innerHTML = `
<template>
<style>
html {
--header-title-content: "OpenDev";
--header-icon: url("/static/opendev-sm.png");
--header-background-color: var(--background-color-primary);
--header-icon-size: 1.2em;
--header-border-bottom: 1px solid;
--header-border-image: linear-gradient(to right, #ee265e, #f9b8cb, #ee265e) 1;
}
</style>
</template>
`;
openDevThemeStyle.register('opendev-site-theme');
Gerrit.install(plugin => {
plugin.registerStyleModule('app-theme', 'opendev-site-theme');
const styleEl = document.createElement('style');
styleEl.innerHTML = `
html {
--header-title-content: "OpenDev";
--header-icon: url("/static/opendev-sm.png");
--header-background-color: var(--background-color-primary);
--header-icon-size: 1.2em;
--header-border-bottom: 1px solid;
--header-border-image: linear-gradient(to right, #ee265e, #f9b8cb, #ee265e) 1;
}
`;
document.head.appendChild(styleEl);
});