Skip to content
Snippets Groups Projects
Commit 61f102d4 authored by juanf's avatar juanf
Browse files

SSDM-1959 : Show gene name instead of gene number in ELN plate hierarchy view

SVN: 34251
parent 4d5f542c
No related branches found
No related tags found
No related merge requests found
......@@ -299,6 +299,7 @@ div.inspectorWhiteFont {
}
div.inspector {
width: 400px;
text-decoration: none;
color: #000;
display: block;
......
......@@ -68,153 +68,109 @@ var PrintUtil = new function() {
} else {
defaultColor = "transparent"
}
var inspector = "";
var divID = entity.sampleTypeCode + "_" + entity.code + "_INSPECTOR";
var inspectorClass = 'inspector';
if(customClass) {
inspectorClass += ' ' + customClass;
}
inspector += "<div id='"+divID+"' class='" + inspectorClass + "' style='background-color:" + defaultColor + ";' >";
if(optionalTitle) {
inspector += optionalTitle;
} else {
inspector += "<strong>" + entity.code + "</strong>";
}
inspector += "<table id='" + entity.permId +"_TOOGLE' class='properties table table-condensed'>"
var inspectorClass = 'inspector';
if(customClass) {
inspectorClass += ' ' + customClass;
}
inspector += "<div class='" + inspectorClass + "' style='background-color:" + defaultColor + ";' >";
//Show Properties following the order given on openBIS
var sampleTypePropertiesCode = profile.getAllPropertiCodesForTypeCode(entity.sampleTypeCode);
var sampleTypePropertiesDisplayName = profile.getPropertiesDisplayNamesForTypeCode(entity.sampleTypeCode, sampleTypePropertiesCode);
if(optionalTitle) {
inspector += optionalTitle;
} else {
inspector += "<strong>" + entity.code + "</strong>";
}
inspector += "<table id='" + entity.permId +"_TOOGLE' class='properties table table-condensed'>"
//Show Properties following the order given on openBIS
var sampleTypePropertiesCode = profile.getAllPropertiCodesForTypeCode(entity.sampleTypeCode);
var sampleTypePropertiesDisplayName = profile.getPropertiesDisplayNamesForTypeCode(entity.sampleTypeCode, sampleTypePropertiesCode);
for(var i = 0; i < sampleTypePropertiesCode.length; i++) {
var propertyCode = sampleTypePropertiesCode[i];
var propertyLabel = sampleTypePropertiesDisplayName[i];
var propertyContent = entity.properties[propertyCode];
//
// Fix to show vocabulary labels instead of codes
//
var sampleType = profile.getSampleTypeForSampleTypeCode(entity.sampleTypeCode);
var propertyType = profile.getPropertyTypeFrom(sampleType, propertyCode);
if(propertyType && propertyType.dataType === "CONTROLLEDVOCABULARY") {
var vocabulary = propertyType.vocabulary;
if(vocabulary) {
for(var j = 0; j < vocabulary.terms.length; j++) {
if(vocabulary.terms[j].code === propertyContent) {
propertyContent = vocabulary.terms[j].label;
break;
}
}
}
}
// End Fix
propertyContent = Util.getEmptyIfNull(propertyContent);
var isSingleColumn = false;
if((propertyContent instanceof String) || (typeof propertyContent === "string")) {
var transformerResult = profile.inspectorContentTransformer(entity, propertyCode, propertyContent);
isSingleColumn = transformerResult["isSingleColumn"];
propertyContent = transformerResult["content"];
propertyContent = propertyContent.replace(/\n/g, "<br />");
}
if(propertyContent !== "") {
propertyContent = Util.replaceURLWithHTMLLinks(propertyContent);
inspector += "<tr>";
if(isSingleColumn) {
inspector += "<td class='property' colspan='2'>"+propertyLabel+"<br />"+propertyContent+"</td>";
} else {
inspector += "<td class='property'>"+propertyLabel+"</td>";
inspector += "<td class='property'><p class='inspectorLineBreak'>"+propertyContent+"</p></td>";
}
inspector += "</tr>";
}
}
for(var i = 0; i < sampleTypePropertiesCode.length; i++) {
var propertyCode = sampleTypePropertiesCode[i];
var propertyLabel = sampleTypePropertiesDisplayName[i];
var propertyContent = null;
//Show Properties not found on openBIS (TO-DO Clean duplicated code)
for(propertyCode in entity.properties) {
if($.inArray(propertyCode, sampleTypePropertiesCode) === -1) {
var propertyLabel = propertyCode;
var propertyContent = entity.properties[propertyCode];
propertyContent = Util.getEmptyIfNull(propertyContent);
var isSingleColumn = false;
if((propertyContent instanceof String) || (typeof propertyContent === "string")) {
var transformerResult = profile.inspectorContentTransformer(entity, propertyCode, propertyContent);
isSingleColumn = transformerResult["isSingleColumn"];
propertyContent = transformerResult["content"];
propertyContent = propertyContent.replace(/\n/g, "<br />");
}
if(propertyContent !== "") {
inspector += "<tr>";
if(isSingleColumn) {
inspector += "<td class='property' colspan='2'>"+propertyLabel+"<br />"+propertyContent+"</td>";
} else {
inspector += "<td class='property'>"+propertyLabel+"</td>";
inspector += "<td class='property'><p class='inspectorLineBreak'>"+propertyContent+"</p></td>";
}
inspector += "</tr>";
}
}
var propertyType = profile.getPropertyType(propertyCode);
if(propertyType && propertyType.dataType === "CONTROLLEDVOCABULARY") {
propertyContent = FormUtil.getVocabularyLabelForTermCode(propertyType, entity.properties[propertyCode]);
} else {
propertyContent = entity.properties[propertyCode];
}
propertyContent = Util.getEmptyIfNull(propertyContent);
//Show Parent Codes
var allParentCodesAsText = this.getParentsChildrenText(entity.parents);
if(allParentCodesAsText.length > 0) {
inspector += "<tr>";
inspector += "<td class='property'>Parents</td>";
inspector += "<td class='property'>"+allParentCodesAsText+"</td>";
inspector += "</tr>";
var isSingleColumn = false;
if((propertyContent instanceof String) || (typeof propertyContent === "string")) {
var transformerResult = profile.inspectorContentTransformer(entity, propertyCode, propertyContent);
isSingleColumn = transformerResult["isSingleColumn"];
propertyContent = transformerResult["content"];
propertyContent = propertyContent.replace(/\n/g, "<br />");
}
//Show Children Codes
var allChildrenCodesAsText = this.getParentsChildrenText(entity.children);
if(allChildrenCodesAsText.length > 0) {
if(propertyContent !== "") {
propertyContent = Util.replaceURLWithHTMLLinks(propertyContent);
inspector += "<tr>";
inspector += "<td class='property'>Children</td>";
inspector += "<td class='property'>"+allChildrenCodesAsText+"</td>";
if(isSingleColumn) {
inspector += "<td class='property' colspan='2'>"+propertyLabel+"<br />"+propertyContent+"</td>";
} else {
inspector += "<td class='property'>"+propertyLabel+"</td>";
inspector += "<td class='property'><p class='inspectorLineBreak'>"+propertyContent+"</p></td>";
}
inspector += "</tr>";
}
}
//Show Modification Date
//Show Parent Codes
var allParentCodesAsText = this.getParentsChildrenText(entity.parents);
if(allParentCodesAsText.length > 0) {
inspector += "<tr>";
inspector += "<td class='property'>Modification Date</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["modificationDate"])+"</td>";
inspector += "<td class='property'>Parents</td>";
inspector += "<td class='property'>"+allParentCodesAsText+"</td>";
inspector += "</tr>";
//Show Creation Date
}
//Show Children Codes
var allChildrenCodesAsText = this.getParentsChildrenText(entity.children);
if(allChildrenCodesAsText.length > 0) {
inspector += "<tr>";
inspector += "<td class='property'>Registration Date</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["registrationDate"])+"</td>";
inspector += "<td class='property'>Children</td>";
inspector += "<td class='property'>"+allChildrenCodesAsText+"</td>";
inspector += "</tr>";
}
inspector += "</table>"
var extraContainerId = null;
var extraHTML = null;
if(extraContent && extraCustomId) {
extraContainerId = extraCustomId;
extraHTML = extraContent;
} else {
extraContainerId = this.getExtraContainerId(entity);
extraHTML = "";
}
inspector += "<div class='inspectorExtra' id='"+ extraContainerId + "'>" + extraHTML + "</div>";
profile.inspectorContentExtra(extraContainerId, entity);
inspector += "</div>"
//Show Modification Date
inspector += "<tr>";
inspector += "<td class='property'>Modification Date</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["modificationDate"])+"</td>";
inspector += "</tr>";
//Show Creation Date
inspector += "<tr>";
inspector += "<td class='property'>Registration Date</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["registrationDate"])+"</td>";
inspector += "</tr>";
inspector += "</table>"
var extraContainerId = null;
var extraHTML = null;
if(extraContent && extraCustomId) {
extraContainerId = extraCustomId;
extraHTML = extraContent;
} else {
extraContainerId = this.getExtraContainerId(entity);
extraHTML = "";
}
inspector += "<div class='inspectorExtra' id='"+ extraContainerId + "'>" + extraHTML + "</div>";
profile.inspectorContentExtra(extraContainerId, entity);
inspector += "</div>"
return inspector;
}
......
......@@ -19,7 +19,7 @@ function PlateView(plateController, plateModel) {
this.getPlaceHolder = function() {
var container = $("<div>", { "id" : this._plateModel.getPlaceHolderId() });
var gridTable = $("<table>", { "class" : "table table-bordered gridTable" });
var gridTable = $("<table>", { "class" : "table table-bordered gridTable", "style" : "table-layout: fixed;" });
for(var i = 0; i <= this._plateModel.numRows; i++) {
var $row = $("<tr>");
......@@ -46,7 +46,7 @@ function PlateView(plateController, plateModel) {
this.repaint = function($container) {
var _this = this;
$container.empty();
var gridTable = $("<table>", { "class" : "table table-bordered gridTable" });
var gridTable = $("<table>", { "class" : "table table-bordered gridTable", "style" : "table-layout: fixed;" });
for(var i = 0; i <= this._plateModel.numRows; i++) {
var $row = $("<tr>");
......@@ -63,11 +63,11 @@ function PlateView(plateController, plateModel) {
$cell = $("<td>").append("&nbsp;");
if(well) {
$cell.addClass('well');
var tooltip = PrintUtil.getTable(well, false, well.code, 'inspectorWhiteFont');
var tooltip = PrintUtil.getTable(well, false, null, 'inspectorWhiteFont');
$cell.tooltipster({
content: $(tooltip),
interactive: true
});
content: $(tooltip),
interactive: true
});
}
}
$cell.css('width', Math.floor(80/this._plateModel.numColumns+1) +'%');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment