Load default site theme if provided
Change-Id: Ic0b691aafa35abbaf293099634d652c01e703456
This commit is contained in:
@@ -31,6 +31,11 @@
|
||||
_configChanged(config) {
|
||||
const jsPlugins = config.js_resource_paths || [];
|
||||
const htmlPlugins = config.html_resource_paths || [];
|
||||
const defaultTheme = config.default_theme;
|
||||
if (defaultTheme) {
|
||||
// Make theme first to be first to load.
|
||||
htmlPlugins.unshift(defaultTheme);
|
||||
}
|
||||
Gerrit._setPluginsCount(jsPlugins.length + htmlPlugins.length);
|
||||
this._loadJsPlugins(jsPlugins);
|
||||
this._importHtmlPlugins(htmlPlugins);
|
||||
@@ -62,7 +67,10 @@
|
||||
if (pathOrUrl.startsWith('http')) {
|
||||
return pathOrUrl;
|
||||
}
|
||||
return this.getBaseUrl() + '/' + pathOrUrl;
|
||||
if (!pathOrUrl.startsWith('/')) {
|
||||
pathOrUrl = '/' + pathOrUrl;
|
||||
}
|
||||
return this.getBaseUrl() + pathOrUrl;
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -131,5 +131,16 @@ limitations under the License.
|
||||
assert.isTrue(element._createScriptTag.calledWith(
|
||||
'https://example.com/baz'));
|
||||
});
|
||||
|
||||
test('default theme is loaded with html plugins', () => {
|
||||
element.config = {
|
||||
default_theme: '/oof',
|
||||
html_resource_paths: ['some'],
|
||||
};
|
||||
assert.isTrue(element.importHref.calledWith(
|
||||
'/oof', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
|
||||
assert.isTrue(element.importHref.calledWith(
|
||||
'/some', Gerrit._pluginInstalled, Gerrit._pluginInstalled, true));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user