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 { ...@@ -299,6 +299,7 @@ div.inspectorWhiteFont {
} }
div.inspector { div.inspector {
width: 400px;
text-decoration: none; text-decoration: none;
color: #000; color: #000;
display: block; display: block;
......
...@@ -68,153 +68,109 @@ var PrintUtil = new function() { ...@@ -68,153 +68,109 @@ var PrintUtil = new function() {
} else { } else {
defaultColor = "transparent" defaultColor = "transparent"
} }
var inspector = ""; 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 if(optionalTitle) {
var sampleTypePropertiesCode = profile.getAllPropertiCodesForTypeCode(entity.sampleTypeCode); inspector += optionalTitle;
var sampleTypePropertiesDisplayName = profile.getPropertiesDisplayNamesForTypeCode(entity.sampleTypeCode, sampleTypePropertiesCode); } 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++) { for(var i = 0; i < sampleTypePropertiesCode.length; i++) {
var propertyCode = sampleTypePropertiesCode[i];
var propertyCode = sampleTypePropertiesCode[i]; var propertyLabel = sampleTypePropertiesDisplayName[i];
var propertyLabel = sampleTypePropertiesDisplayName[i]; var propertyContent = null;
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>";
}
}
//Show Properties not found on openBIS (TO-DO Clean duplicated code) var propertyType = profile.getPropertyType(propertyCode);
for(propertyCode in entity.properties) { if(propertyType && propertyType.dataType === "CONTROLLEDVOCABULARY") {
if($.inArray(propertyCode, sampleTypePropertiesCode) === -1) { propertyContent = FormUtil.getVocabularyLabelForTermCode(propertyType, entity.properties[propertyCode]);
var propertyLabel = propertyCode; } else {
var propertyContent = entity.properties[propertyCode]; 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>";
}
}
} }
propertyContent = Util.getEmptyIfNull(propertyContent);
//Show Parent Codes var isSingleColumn = false;
var allParentCodesAsText = this.getParentsChildrenText(entity.parents); if((propertyContent instanceof String) || (typeof propertyContent === "string")) {
if(allParentCodesAsText.length > 0) { var transformerResult = profile.inspectorContentTransformer(entity, propertyCode, propertyContent);
inspector += "<tr>"; isSingleColumn = transformerResult["isSingleColumn"];
inspector += "<td class='property'>Parents</td>"; propertyContent = transformerResult["content"];
inspector += "<td class='property'>"+allParentCodesAsText+"</td>"; propertyContent = propertyContent.replace(/\n/g, "<br />");
inspector += "</tr>";
} }
//Show Children Codes if(propertyContent !== "") {
var allChildrenCodesAsText = this.getParentsChildrenText(entity.children); propertyContent = Util.replaceURLWithHTMLLinks(propertyContent);
if(allChildrenCodesAsText.length > 0) {
inspector += "<tr>"; 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>"; inspector += "</tr>";
} }
}
//Show Modification Date //Show Parent Codes
var allParentCodesAsText = this.getParentsChildrenText(entity.parents);
if(allParentCodesAsText.length > 0) {
inspector += "<tr>"; inspector += "<tr>";
inspector += "<td class='property'>Modification Date</td>"; inspector += "<td class='property'>Parents</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["modificationDate"])+"</td>"; inspector += "<td class='property'>"+allParentCodesAsText+"</td>";
inspector += "</tr>"; inspector += "</tr>";
}
//Show Creation Date
//Show Children Codes
var allChildrenCodesAsText = this.getParentsChildrenText(entity.children);
if(allChildrenCodesAsText.length > 0) {
inspector += "<tr>"; inspector += "<tr>";
inspector += "<td class='property'>Registration Date</td>"; inspector += "<td class='property'>Children</td>";
inspector += "<td class='property'>"+new Date(entity.registrationDetails["registrationDate"])+"</td>"; inspector += "<td class='property'>"+allChildrenCodesAsText+"</td>";
inspector += "</tr>"; inspector += "</tr>";
}
inspector += "</table>" //Show Modification Date
inspector += "<tr>";
var extraContainerId = null; inspector += "<td class='property'>Modification Date</td>";
var extraHTML = null; inspector += "<td class='property'>"+new Date(entity.registrationDetails["modificationDate"])+"</td>";
if(extraContent && extraCustomId) { inspector += "</tr>";
extraContainerId = extraCustomId;
extraHTML = extraContent; //Show Creation Date
} else { inspector += "<tr>";
extraContainerId = this.getExtraContainerId(entity); inspector += "<td class='property'>Registration Date</td>";
extraHTML = ""; inspector += "<td class='property'>"+new Date(entity.registrationDetails["registrationDate"])+"</td>";
} inspector += "</tr>";
inspector += "<div class='inspectorExtra' id='"+ extraContainerId + "'>" + extraHTML + "</div>";
profile.inspectorContentExtra(extraContainerId, entity); inspector += "</table>"
inspector += "</div>" 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; return inspector;
} }
......
...@@ -19,7 +19,7 @@ function PlateView(plateController, plateModel) { ...@@ -19,7 +19,7 @@ function PlateView(plateController, plateModel) {
this.getPlaceHolder = function() { this.getPlaceHolder = function() {
var container = $("<div>", { "id" : this._plateModel.getPlaceHolderId() }); 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++) { for(var i = 0; i <= this._plateModel.numRows; i++) {
var $row = $("<tr>"); var $row = $("<tr>");
...@@ -46,7 +46,7 @@ function PlateView(plateController, plateModel) { ...@@ -46,7 +46,7 @@ function PlateView(plateController, plateModel) {
this.repaint = function($container) { this.repaint = function($container) {
var _this = this; var _this = this;
$container.empty(); $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++) { for(var i = 0; i <= this._plateModel.numRows; i++) {
var $row = $("<tr>"); var $row = $("<tr>");
...@@ -63,11 +63,11 @@ function PlateView(plateController, plateModel) { ...@@ -63,11 +63,11 @@ function PlateView(plateController, plateModel) {
$cell = $("<td>").append("&nbsp;"); $cell = $("<td>").append("&nbsp;");
if(well) { if(well) {
$cell.addClass('well'); $cell.addClass('well');
var tooltip = PrintUtil.getTable(well, false, well.code, 'inspectorWhiteFont'); var tooltip = PrintUtil.getTable(well, false, null, 'inspectorWhiteFont');
$cell.tooltipster({ $cell.tooltipster({
content: $(tooltip), content: $(tooltip),
interactive: true interactive: true
}); });
} }
} }
$cell.css('width', Math.floor(80/this._plateModel.numColumns+1) +'%'); $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