Skip to content

Use node icon alignment #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ To test you will want to add a few nodes to the database. To do so, use the upd

or in the docker container running the application

docker exec -it flowlibrary_node_1 node tasks/update-one.js node-red-dashboard
docker exec -it flow-library_node_1 node tasks/update-one.js node-red-dashboard
6 changes: 6 additions & 0 deletions lib/modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,12 @@ function getNodeDefinitions(filename) {
} else {
errors.push({ code:"outputs-not-inline" });
}
} else if (nodeDef.key.name === 'align') {
if (nodeDef.value.type === 'Literal') {
defs[defType].align = nodeDef.value.value;
} else {
errors.push({ code:"align-not-inline" });
}
}
});
} else {
Expand Down
16 changes: 14 additions & 2 deletions public/css/library.css
Original file line number Diff line number Diff line change
Expand Up @@ -776,18 +776,30 @@ a:hover .gistbox-footer {
position: absolute;
top:0;
bottom:0;
left:0;
width: 30px;
border-right: 2px solid rgba(0,0,0,0.1);
background-color: rgba(0,0,0,0.05);
background-position: 50% 50%;
background-size: contain;
background-repeat: no-repeat;
}
.palette_icon_left {
left:0;
border-right: 2px solid rgba(0,0,0,0.1);
}
.palette_icon_right {
right:0;
border-left: 2px solid rgba(0,0,0,0.1);
}
.palette_label {
padding: 0 10px;
min-width: 90px;
}
.palette_label-icon_left {
margin-left:28px;
}
.palette_label-icon_right {
margin-right:28px;
}
.palette_node_config {
border-color: #aaa;
border-style: dashed;
Expand Down
4 changes: 4 additions & 0 deletions routes/nodes.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ app.get("/node/:scope(@[^\\/]{1,})?/:id([^@][^\\/]{1,})",csrfProtection,function
}
def.types[t].hasInputs = (def.types[t].inputs > 0);
def.types[t].hasOutputs = (def.types[t].outputs > 0);

def.types[t].leftIconAlignment = (def.types[t].align !== 'right');
def.types[t].rightIconAlignment = (def.types[t].align === 'right');

if (def.types[t].category == "config") {
delete def.types[t].color;
}
Expand Down
4 changes: 2 additions & 2 deletions template/_palettenode.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<li style="margin-bottom: 5px;">
<div class="palette_node palette_node_{{category}}" style="background-color:{{color}};">
{{#iconUrl}}<div class="palette_icon" style="background-image: url({{iconUrl}})"></div>{{/iconUrl}}
<div class="palette_label" {{#iconUrl}}style="margin-left: 28px"{{/iconUrl}}>{{name}}</div>
{{#iconUrl}}<div class="palette_icon palette_icon_{{#rightIconAlignment}}right{{/rightIconAlignment}}{{^rightIconAlignment}}left{{/rightIconAlignment}}" style="background-image: url({{iconUrl}})"></div>{{/iconUrl}}
<div class="palette_label {{#iconUrl}}palette_label-icon_{{#rightIconAlignment}}right{{/rightIconAlignment}}{{^rightIconAlignment}}left{{/rightIconAlignment}}{{/iconUrl}}">{{name}}</div>
{{#hasOutputs}}<div class="palette_port palette_port_output"></div>{{/hasOutputs}}
{{#hasInputs}}<div class="palette_port palette_port_input"></div>{{/hasInputs}}
</div>
Expand Down