Skip to content

Commit

Permalink
added new node type
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerrit Riessen committed Sep 18, 2024
1 parent 04f89b1 commit 152292f
Show file tree
Hide file tree
Showing 18 changed files with 282 additions and 10 deletions.
1 change: 1 addition & 0 deletions icons.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"node-red.svg",
"open_mind_logo.svg"
],
"@gregoriusrippenstein/node-red-artworks": [],
"@gregoriusrippenstein/node-red-contacts": [],
"@gregoriusrippenstein/node-red-contrib-aisbreaker": [
"logo.png"
Expand Down
16 changes: 16 additions & 0 deletions nodes/messages
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {
"artwork": {
"label": {
"displayedat": "Displayed At",
"imageurl": "Image Url",
"size": "Size",
"statusset": "Status Set",
"title": "Title",
"website": "Website"
},
"status": {
"timeout": "No more time to waiting",
"waiting": "Waiting for Godot"
}
}
},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {
"contact": {
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.de
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.de-DE
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.en
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.en-GB
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
16 changes: 16 additions & 0 deletions nodes/messages.en-US
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {
"artwork": {
"label": {
"displayedat": "Displayed At",
"imageurl": "Image Url",
"size": "Size",
"statusset": "Status Set",
"title": "Title",
"website": "Website"
},
"status": {
"timeout": "No more time to waiting",
"waiting": "Waiting for Godot"
}
}
},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {
"contact": {
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.fr
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.ja
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.ko
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.pt-BR
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.ru
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.zh-CN
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
1 change: 1 addition & 0 deletions nodes/messages.zh-TW
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@gorenje/node-red-contrib-mindmap/thought": {},
"@gorenje/node-red-contrib-mindmap/topic": {},
"@gorenje/node-red-contrib-mindmap/treasure": {},
"@gregoriusrippenstein/node-red-artworks/artwork": {},
"@gregoriusrippenstein/node-red-contacts/addressbook": {},
"@gregoriusrippenstein/node-red-contacts/contact": {},
"@gregoriusrippenstein/node-red-contacts/emptycontact": {},
Expand Down
216 changes: 216 additions & 0 deletions nodes/nodes.html
Original file line number Diff line number Diff line change
Expand Up @@ -13580,6 +13580,222 @@ <h3>Details</h3>
<script type="text/html" data-help-name="Author">
<p>A writermap node.</p>
</script>
<!-- --- [red-module:@gregoriusrippenstein/node-red-artworks/artwork] --- -->
<script type="text/javascript">
(function(){

RED.nodes.registerType('ArtWork',{
color: '#FDD0A284',
icon: "font-awesome/fa-paint-brush",
category: 'art',
defaults: {
name: { value:"", },
info: {
value: ""
},

imageurl: { value: "" },
website: { value: "" },

description: { value: "" },
size: { value: ""},

composedOn: { value: undefined },
displayedOn: { value: undefined },
displayedat: { value: "" },
soldOn: { value: undefined },

/* createdAt and updatedAt are "internal" attributes that track just
that: when the node was created and the last time it was updated.
These aren't shown in the edit window because they are maintained
internally. These are managed by BlogChanges node (onpaletteadd has
event listeners for updating these values).
*/
createdAt: {
value: "",
},
updatedAt: {
value: "",
}

},

inputs: 1,

outputs: 1,

generatevCardJson: function() {
let vCardDetails = [
["version", {}, "text", "3.0"],
["prodid", {}, "text", "//ArtWork Node//EN-US"],
["photo", { value: "uri" }, "text", this.imageurl],
["fn", {}, "text", this.name],
["url", { type: "website" }, "text", this.website],
["url", { type: "image" }, "text", this.imageurl],
["note", {}, "text", this.description.replace(/\n/, " ") + " Size: " + this.size],
]

let addArtistDetails = (artist) => {
vCardDetails.push(["org", {}, "text", artist.name])

JSON.parse(artist.rawJsonData)[1].forEach( ary => {
if ( ["url","tel","email"].includes(ary[0])) {
vCardDetails.push(ary)
}
})
}

RED.nodes.eachLink(lnk => {
if (lnk.target.id == this.id && lnk.source.type == "Contact") {
let artist = lnk.source
addArtistDetails(artist)
}
})

return ["vcard", vCardDetails]
},

label: function() {
return (this.name || this._def.paletteLabel);
},

labelStyle: function() {
return this.name?"node_label_italic":"";
},

onpaletteadd: function() {
},

onpaletteremove: function() {
},

oneditprepare: function() {
if (this.imageurl) {
$('#artwork-image').attr('src', this.imageurl)
} else {
$('#artwork-image').attr('src', 'data:image/jpeg;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAEeDAABHgwGWlmvoAAAAB3RJTUUH6AgWDBk2LmG1KAAA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0Z+lWtY0rDnww//0V1bW/e81+u7m5mhlAJP1A1HgIUQICIYhnGqvf3SLx5+ePWh1155ztq2bR0octeY9XohB319XWg5ctR66KFVB3fv3nVm2bLlGysqKr/h8bhrANKYGTfHzT03B8Ayl8tfHhjof//w4eYDzz77k7a1ax/B2s1PgSKzxhMudpKaObNwub0DyWQc4XC5vmvXzjkLFy5aXlFR2eT3++fpul4hhPACgFLKtG17IJvNXhgY6G85efJE8/btz7UPDcXt0tJy1NTMwuXLHYUjNpl8RqPlOHbsKGpq6kBEvief3FRaW1sXCYVCAYCRSg1n2touJfbte3uImY329otYsqQBsdjgHX3rk8BHLBbHnDlzAQAzZ84wqqurjZUrv3Zj/vz5AIDW1laYZhYzZ8743IL9P5c7p9Z2Q/lhAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTA4LTIyVDEwOjI1OjU0KzAyOjAwP+ws3AAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0wOC0yMlQxMDoyNTo1NCswMjowME6xlGAAAAAASUVORK5CYII=')
}

if (!this.composedOn || this.composedOn == "") {
$('#node-input-composedOn').val(
(new Date()).toISOString().substring(0, 16)
);
}

this.editor = RED.editor.createEditor({
id: 'node-input-description',
mode: 'ace/mode/markdown',
value: $("#node-input-description").val()
});

$('#node-input-imageurl-link').attr('href', this.imageurl)
$('#node-input-website-link').attr('href', this.website)
},

oneditcancel: function () {
this.editor.destroy();
delete this.editor;
},

oneditsave: function() {
$("#node-input-description").val(this.editor.getValue());

this.info = `
# ${ $("#node-input-name").val() }

![image](${ $("#node-input-imageurl").val() })

${ $("#node-input-description").val() }
`

this.editor.destroy();
delete this.editor;
},

oneditresize: function(size) {
},


});
})();

</script>

<script type="text/html" data-template-name="ArtWork">

<div class="form-row">
<center>
<img id="artwork-image" src="" width="400"/>
</center>
</div>


<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="artwork.label.title"></span></label>
<input type="text" id="node-input-name" data-i18n="[placeholder]artwork.label.title">
</div>


<div class="form-row">
<label for="node-input-description">
<i class="fa fa-tag"></i>
<span>Description</span>
</label>
<div style="height: 150px; min-height:150px; max-height: 150px;" class="node-text-editor" id="node-input-description">
</div>
</div>

<div class="form-row">
<label for="node-input-size"><i class="fa fa-square-o"></i> <span data-i18n="artwork.label.size"></span></label>
<input type="text" id="node-input-size" data-i18n="[placeholder]artwork.label.size">
</div>

<div class="form-row">
<label for="node-input-composedOn">
<i class="fa fa-clock-o"></i>
<span>Composed</span>
</label>
<input type="datetime-local" id="node-input-composedOn">
</div>

<div class="form-row">
<label for="node-input-displayedOn">
<i class="fa fa-clock-o"></i>
<span>Displayed</span>
</label>
<input type="datetime-local" id="node-input-displayedOn">
</div>

<div class="form-row">
<label for="node-input-displayedat"><i class="fa fa-map-pin"></i> <span data-i18n="artwork.label.displayedat"></span></label>
<input type="text" id="node-input-displayedat" data-i18n="[placeholder]artwork.label.displayedat">
</div>

<div class="form-row">
<label for="node-input-soldOn">
<i class="fa fa-clock-o"></i>
<span>Sold</span>
</label>
<input type="datetime-local" id="node-input-soldOn">
</div>

<div class="form-row">
<label for="node-input-imageurl"><i class="fa fa-link"></i> <span data-i18n="artwork.label.imageurl"></span></label>
<input type="text" id="node-input-imageurl" data-i18n="[placeholder]artwork.label.imageurl">
<a id="node-input-imageurl-link" style="color: blue; margin-left: 10px;" target=_blank href="#"><i class='fa fa-external-link'></i></a>
</div>

<div class="form-row">
<label for="node-input-website"><i class="fa fa-link"></i> <span data-i18n="artwork.label.website"></span></label>
<input type="text" id="node-input-website" data-i18n="[placeholder]artwork.label.website">
<a id="node-input-website-link" style="color: blue; margin-left: 10px;" target=_blank href="#"><i class='fa fa-external-link'></i></a>
</div>
</script>
<script type="text/html" data-help-name="ArtWork">
<p>Representation of a piece of art</p>
Representation of art
</script>

<!-- --- [red-module:@gregoriusrippenstein/node-red-contacts/contact] --- -->
<script type="text/javascript">
(function () {
Expand Down
Loading

0 comments on commit 152292f

Please sign in to comment.