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() {
$("#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;
searchInput.searchBox('count',loadedList.length);
loadedList.forEach(function(m) {
@ -321,6 +322,8 @@ RED.palette.editor = (function() {
}
function init() {
$(".palette-editor-button").show();
editorTabs = RED.tabs.create({
id:"palette-editor-tabs",
onchange:function(tab) {

View File

@ -17,7 +17,7 @@
RED.palette = (function() {
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 = {};
@ -174,7 +174,7 @@ RED.palette = (function() {
}
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}));
} else {
var ns = def.set.id;
@ -438,15 +438,18 @@ RED.palette = (function() {
}
})
var categoryList = coreCategories;
if (RED.settings.paletteCategories) {
RED.settings.paletteCategories.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
} else {
core.forEach(function(category){
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
});
categoryList = RED.settings.paletteCategories;
} else if (RED.settings.theme('palette.categories')) {
categoryList = RED.settings.theme('palette.categories');
}
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) {
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 {

View File

@ -67,7 +67,7 @@
</div>
<div id="palette-container" class="palette-scroll hide"></div>
<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>
</div>
<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");
* you may not use this file except in compliance with the License.
@ -94,7 +94,7 @@ module.exports = {
themeContext.page.favicon = url;
}
}
if (theme.page.tabicon) {
url = serveFile(themeApp,"/tabicon/",theme.page.tabicon)
if (url) {
@ -161,6 +161,9 @@ module.exports = {
themeSettings.menu = theme.menu;
}
if (theme.hasOwnProperty("palette")) {
themeSettings.palette = theme.palette;
}
return themeApp;
},
context: function() {