Allow spaces in node category names

Fixes #361
This commit is contained in:
Nick O'Leary 2014-08-29 20:37:30 +01:00
parent 0a3c889cc6
commit fae8b35961
1 changed files with 73 additions and 72 deletions

View File

@ -20,9 +20,9 @@ RED.palette = (function() {
var core = ['input', 'output', 'function', 'social', 'storage', 'analysis', 'advanced'];
function createCategoryContainer(category){
var escapedCategory = category.replace(" ","_");
$("#palette-container").append('<div class="palette-category">'+
'<div id="header-'+category+'" class="palette-header"><i class="expanded fa fa-caret-down"></i><span>'+category+'</span></div>'+
'<div id="header-'+category+'" class="palette-header"><i class="expanded fa fa-caret-down"></i><span>'+category.replace("_"," ")+'</span></div>'+
'<div class="palette-content" id="palette-base-category-'+category+'">'+
'<div id="palette-'+category+'-input"></div>'+
'<div id="palette-'+category+'-output"></div>'+
@ -42,7 +42,8 @@ RED.palette = (function() {
if (exclusion.indexOf(def.category)===-1) {
var category = def.category.split("-");
var category = def.category.replace(" ","_");
var rootCategory = category.split("-")[0];
var d = document.createElement("div");
d.id = "palette_node_"+nt;
@ -75,15 +76,15 @@ RED.palette = (function() {
d.appendChild(portIn);
}
if ($("#palette-base-category-"+category[0]).length === 0){
createCategoryContainer(category[0]);
if ($("#palette-base-category-"+rootCategory).length === 0) {
createCategoryContainer(rootCategory);
}
if ($("#palette-"+def.category).length === 0) {
$("#palette-base-category-"+category[0]).append('<div id="palette-'+def.category+'"></div>');
if ($("#palette-"+category).length === 0) {
$("#palette-base-category-"+rootCategory).append('<div id="palette-'+category+'"></div>');
}
$("#palette-"+def.category).append(d);
$("#palette-"+category).append(d);
d.onmousedown = function(e) { e.preventDefault(); }
$(d).popover({