1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Allow palette-editor to be disabled via editorTheme

This commit is contained in:
Nick O'Leary 2016-08-10 20:15:17 +01:00
parent e4d788ad0b
commit 11656382a7
4 changed files with 25 additions and 14 deletions

View File

@ -304,7 +304,8 @@ RED.palette.editor = (function() {
function initInstallTab() { function initInstallTab() {
$("#palette-module-install-shade").show(); $("#palette-module-install-shade").show();
$.getJSON('http://catalog.nodered.org/catalog.json',function(v) {
$.getJSON('http://catalogue.nodered.org/catalogue.json',function(v) {
loadedList = v; loadedList = v;
searchInput.searchBox('count',loadedList.length); searchInput.searchBox('count',loadedList.length);
loadedList.forEach(function(m) { loadedList.forEach(function(m) {
@ -321,6 +322,8 @@ RED.palette.editor = (function() {
} }
function init() { function init() {
$(".palette-editor-button").show();
editorTabs = RED.tabs.create({ editorTabs = RED.tabs.create({
id:"palette-editor-tabs", id:"palette-editor-tabs",
onchange:function(tab) { onchange:function(tab) {

View File

@ -17,7 +17,7 @@
RED.palette = (function() { RED.palette = (function() {
var exclusion = ['config','unknown','deprecated']; var exclusion = ['config','unknown','deprecated'];
var core = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced']; var coreCategories = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'];
var categoryContainers = {}; var categoryContainers = {};
@ -174,7 +174,7 @@ RED.palette = (function() {
} }
if ($("#palette-base-category-"+rootCategory).length === 0) { if ($("#palette-base-category-"+rootCategory).length === 0) {
if(core.indexOf(rootCategory) !== -1){ if(coreCategories.indexOf(rootCategory) !== -1){
createCategoryContainer(rootCategory, RED._("node-red:palette.label."+rootCategory, {defaultValue:rootCategory})); createCategoryContainer(rootCategory, RED._("node-red:palette.label."+rootCategory, {defaultValue:rootCategory}));
} else { } else {
var ns = def.set.id; var ns = def.set.id;
@ -438,15 +438,18 @@ RED.palette = (function() {
} }
}) })
var categoryList = coreCategories;
if (RED.settings.paletteCategories) { if (RED.settings.paletteCategories) {
RED.settings.paletteCategories.forEach(function(category){ categoryList = RED.settings.paletteCategories;
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category})); } else if (RED.settings.theme('palette.categories')) {
}); categoryList = RED.settings.theme('palette.categories');
} else {
core.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
} }
if (!Array.isArray(categoryList)) {
categoryList = coreCategories
}
categoryList.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
$("#palette-collapse-all").on("click", function(e) { $("#palette-collapse-all").on("click", function(e) {
e.preventDefault(); e.preventDefault();
@ -465,7 +468,9 @@ RED.palette = (function() {
} }
}); });
RED.palette.editor.init(); if (RED.settings.theme('palette.editable') !== false) {
RED.palette.editor.init();
}
} }
return { return {

View File

@ -67,7 +67,7 @@
</div> </div>
<div id="palette-container" class="palette-scroll hide"></div> <div id="palette-container" class="palette-scroll hide"></div>
<div id="palette-footer"> <div id="palette-footer">
<div style="float:left"> <div style="float:left" class="palette-editor-button hide">
<a class="palette-button palette-button-left" id="palette-edit" href="#"><i class="fa fa-cog"></i></a> <a class="palette-button palette-button-left" id="palette-edit" href="#"><i class="fa fa-cog"></i></a>
</div> </div>
<a class="palette-button" id="palette-collapse-all" href="#"><i class="fa fa-angle-double-up"></i></a> <a class="palette-button" id="palette-collapse-all" href="#"><i class="fa fa-angle-double-up"></i></a>

View File

@ -1,5 +1,5 @@
/** /**
* Copyright 2015 IBM Corp. * Copyright 2015, 2016 IBM Corp.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -161,6 +161,9 @@ module.exports = {
themeSettings.menu = theme.menu; themeSettings.menu = theme.menu;
} }
if (theme.hasOwnProperty("palette")) {
themeSettings.palette = theme.palette;
}
return themeApp; return themeApp;
}, },
context: function() { context: function() {