From 6e128a84d8b6a1a503993044160d32a2524bfaae Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Tue, 7 Jul 2020 09:53:54 +0200 Subject: [PATCH] DOC: docstrings --- src/core/js/caosdb.js | 13 +++++++------ src/core/js/form_elements.js | 14 ++++++++++---- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/core/js/caosdb.js b/src/core/js/caosdb.js index efc79764..c6b3ce81 100644 --- a/src/core/js/caosdb.js +++ b/src/core/js/caosdb.js @@ -135,18 +135,19 @@ function getEntityRole(element) { } /** - * Return the unit of element. - * If the corresponding data-attribute can not be found undefined is returned. - * @return A string containing the datatype of the element. + * Return the unit of entity or undefined. + * + * @param {HTMLElement} entity + * @return {String} */ -function getEntityUnit(element) { - var res = $(element).find("input.caosdb-f-entity-unit"); +function getEntityUnit(entity) { + var res = $(entity).find("input.caosdb-f-entity-unit"); if (res.length == 1) { var x = res.val(); return (x == '' ? undefined : x); } - return getEntityHeadingAttribute(element, "unit"); + return getEntityHeadingAttribute(entity, "unit"); } /** diff --git a/src/core/js/form_elements.js b/src/core/js/form_elements.js index d005dd8b..0a492637 100644 --- a/src/core/js/form_elements.js +++ b/src/core/js/form_elements.js @@ -199,13 +199,19 @@ var form_elements = new function () { /** * Return SELECT form element with entity references. * - * The OPTIONS have the entities' ids as values and a description which - * is generated by a `make_desc` call-back function. If `make_desc` is - * undefined, the ids are shown instead. + * The OPTIONS' values are generated by the `make_value` call-back + * function from the entities. If `make_value` is undefined the + * entities' ids are used as values. The description which is generated + * by a `make_desc` call-back function. If `make_desc` is undefined, + * the ids are shown instead. * * @param {HTMLElement[]} entities - an array with entity elements. * @param {function} [make_desc] - a call-back function with one - * parameter. + * parameter which is an entity in HTML representation. + * @param {function} [make_value] - a call-back function with one + * parameter which is an entity in HTML representation. + * @param {boolean} [multiple] - whether the select allows multiple + * options to be selected. * @returns {HTMLElement} SELECT element with entity options. */ this.make_reference_select = async function (entities, make_desc, -- GitLab