Commit 1601acaa authored by Piotr Gawron's avatar Piotr Gawron
Browse files

author list handles missing values properly

parent 15d235c9
Pipeline #23832 passed with stage
in 14 minutes and 31 seconds
...@@ -9,6 +9,8 @@ minerva (14.0.11) stable; urgency=medium ...@@ -9,6 +9,8 @@ minerva (14.0.11) stable; urgency=medium
minerva (#1202) minerva (#1202)
* Bug fix: infinity value in kinetic parameter could not be parsed from * Bug fix: infinity value in kinetic parameter could not be parsed from
CellDesigner file minerva (#1203) CellDesigner file minerva (#1203)
* Bug fix: author list inproperly presented author data when some fields were
missing (#1201)
-- Piotr Gawron <piotr.gawron@uni.lu> Mon, 30 Mar 2020 10:00:00 +0200 -- Piotr Gawron <piotr.gawron@uni.lu> Mon, 30 Mar 2020 10:00:00 +0200
......
...@@ -453,17 +453,26 @@ GuiUtils.prototype.createAuthorsList = function (authors) { ...@@ -453,17 +453,26 @@ GuiUtils.prototype.createAuthorsList = function (authors) {
className: "minerva-annotation-body" className: "minerva-annotation-body"
}); });
var desc = author.firstName + " " + author.lastName; var desc = "";
if (author.firstName !== null && author.firstName !== undefined) {
desc = author.firstName + " ";
}
if (author.lastName !== null && author.lastName !== undefined) {
desc += author.lastName;
}
if (desc === "") {
desc = author.email;
}
var link; var link;
if (author.email !== undefined) { if (author.email !== undefined && author.email !== null) {
link = Functions.createElement({type: "a", href: "mailto:" + author.email, content: desc}); link = Functions.createElement({type: "a", href: "mailto:" + author.email, content: desc});
} else { } else {
link = Functions.createElement({type: "span", content: desc}); link = Functions.createElement({type: "span", content: desc});
} }
body.appendChild(link); body.appendChild(link);
if (author.organisation !== undefined) { if (author.organisation !== undefined && author.organisation !== null) {
body.appendChild(Functions.createElement({type: "span", content: ", " + author.organisation})); body.appendChild(Functions.createElement({type: "span", content: ", " + author.organisation}));
} }
......
...@@ -13,10 +13,10 @@ var Reaction = require('./Reaction'); ...@@ -13,10 +13,10 @@ var Reaction = require('./Reaction');
/** /**
* @typedef {Object} Author * @typedef {Object} Author
* @property {string} firstName * @property {?null|string} firstName
* @property {string} lastName * @property {?null|string} lastName
* @property {string} [organisation] * @property {?null|string} [organisation]
* @property {string} [email] * @property {?null|string} [email]
*/ */
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment