From abed5088c22c9f5014f6cff0e7959d3885eec7d7 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Tue, 3 Jun 2014 14:19:32 +0000
Subject: [PATCH] SSDM-306: Changed toolbox for dropdown on Sample Table.

SVN: 31646
---
 .../as/webapps/newbrowser/html/css/style.css  |  1 +
 .../newbrowser/html/js/views/SampleTable.js   | 21 ++++++++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/css/style.css b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/css/style.css
index ecc407baa4d..8382473e8bc 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/css/style.css
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/css/style.css
@@ -183,6 +183,7 @@ h1, h2, legend {
 
 .toolBox {
 	float: right !important;
+	margin-right: 50px;
 }
 
 .toolBox a {
diff --git a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleTable.js b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleTable.js
index 5a67ef50f3c..45e1ee3a3e6 100644
--- a/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleTable.js
+++ b/plasmid/source/core-plugins/newbrowser/1/as/webapps/newbrowser/html/js/views/SampleTable.js
@@ -517,9 +517,24 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
 		$("#paginationContainerTop").append(this._getPaginationComponent(this._filteredSamples.length, this._start, this._limit, this._adjacentPages));
 		if (!this.isEmbedded && !this.isSearch) {
 			$("#paginationContainerTop").append("<span class='toolBox' id='toolBoxContainer'></span>");
-			$("#toolBoxContainer").append("<input type='file' id='fileToRegister' style='display:none;' /><a class='btn btn-default' title='register new samples' href=\"javascript:mainController.currentView.registerSamples();\"><span class='glyphicon glyphicon-upload'></span>r</a>");
-			$("#toolBoxContainer").append("<input type='file' id='fileToUpdate' style='display:none;' /><a class='btn btn-default' title='update existing samples'href=\"javascript:mainController.currentView.updateSamples();\"><span class='glyphicon glyphicon-upload'></span>u</a>");
-			$("#toolBoxContainer").append("<a class='btn btn-default' title='create a new sample' href=\"javascript:mainController.currentView.createNewSample();\"><span class='glyphicon glyphicon-plus-sign'></span></a>");
+			
+			var sampleType = this.profile.getTypeForTypeCode(this.sampleTypeCode);
+			var sampleTypeDisplayName = Util.getEmptyIfNull(sampleType.description);
+			if(sampleTypeDisplayName === "") {
+				sampleTypeDisplayName = sampleType.code;
+			}
+			
+			var dropDownMenu = "";
+			dropDownMenu += "<div class='dropdown'>";
+			dropDownMenu += "<a href='#' data-toggle='dropdown' class='dropdown-toggle btn btn-default'>Options <b class='caret'></b></a>";
+			dropDownMenu += "<ul class='dropdown-menu' role='menu' aria-labelledby='sampleTableDropdown'>";
+			dropDownMenu += "	<li role='presentation'><a class='' title='create a new sample' href=\"javascript:mainController.currentView.createNewSample();\">Create " + sampleTypeDisplayName + "</a></li>";
+			dropDownMenu += "	<li role='presentation'><input type='file' id='fileToRegister' style='display:none;' /><a class='' title='register new samples' href=\"javascript:mainController.currentView.registerSamples();\">Register " + sampleTypeDisplayName + "</a></li>";
+			dropDownMenu += "	<li role='presentation'><input type='file' id='fileToUpdate' style='display:none;' /><a class='' title='update existing samples'href=\"javascript:mainController.currentView.updateSamples();\">Update " + sampleTypeDisplayName + "</a></li>";
+			dropDownMenu += "</ul>";
+			dropDownMenu += "</div>";
+			
+			$("#toolBoxContainer").append(dropDownMenu);
 		}
 		$("#paginationContainerBottom").empty();
 		$("#paginationContainerBottom").append(this._getPaginationComponent(this._filteredSamples.length, this._start, this._limit, this._adjacentPages));
-- 
GitLab