mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Make theme able to load custom javascript (#1211)
* Make theme able to load custom javascript - Look for the field 'customScript' in editorTheme (settings.js) - Add it to mustach context - Load list on template side (index.mst) * Add unit tests for customScripts * Code review edits : generic behavior for theme.page.[css|scripts] - Use the same way to share css and javascript files from a theme - Allow string instead of array for theme.page.scripts - Remove old customScript field
This commit is contained in:
@@ -55,7 +55,8 @@ describe("theme handler", function() {
|
||||
page: {
|
||||
title: "Test Page Title",
|
||||
favicon: "/absolute/path/to/theme/icon",
|
||||
css: "/absolute/path/to/custom/css/file"
|
||||
css: "/absolute/path/to/custom/css/file",
|
||||
scripts: "/absolute/path/to/script.js"
|
||||
},
|
||||
header: {
|
||||
title: "Test Header Title",
|
||||
@@ -68,6 +69,10 @@ describe("theme handler", function() {
|
||||
icon: "/absolute/path/to/deploy/button/image" // or null to remove image
|
||||
},
|
||||
|
||||
customScripts: [
|
||||
"/absolute/path/to/script.js"
|
||||
],
|
||||
|
||||
menu: { // Hide unwanted menu items by id. see editor/js/main.js:loadEditor for complete list
|
||||
"menu-item-import-library": false,
|
||||
"menu-item-export-library": false,
|
||||
@@ -93,6 +98,8 @@ describe("theme handler", function() {
|
||||
context.page.should.have.a.property("title","Test Page Title");
|
||||
context.should.have.a.property("header");
|
||||
context.header.should.have.a.property("title","Test Header Title");
|
||||
context.page.should.have.a.property("css");
|
||||
context.page.should.have.a.property("scripts");
|
||||
|
||||
var settings = theme.settings();
|
||||
settings.should.have.a.property("deployButton");
|
||||
|
Reference in New Issue
Block a user