From efe4fa5f0a313489ac6827a24189abf797683fc5 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 29 Sep 2014 09:46:29 +0000
Subject: [PATCH] SSDM-948 : ELN UI - PAPER - Inventory Structure and more

SVN: 32510
---
 .../1/as/webapps/newbrowser/html/css/style.css |  2 +-
 .../newbrowser/html/js/views/SampleTable.js    | 18 ++++++++++++++++--
 2 files changed, 17 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 92e10be7749..38431e368f1 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,7 +183,7 @@ h1, h2, legend {
 
 .toolBox {
 	float: right !important;
-	margin-right: 100px;
+	margin-right: 150px;
 }
 
 .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 2b28b04b182..cb1b1fc9c7d 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
@@ -582,7 +582,7 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
 			dropDownMenu += "<span 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'><a class='' title='create a new sample' href=\"javascript:mainController.currentView.createNewSample();\">Create Sample</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();\">Batch 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();\">Batch Update " + sampleTypeDisplayName + "</a></li>";
 			dropDownMenu += "</ul>";
@@ -598,7 +598,21 @@ function SampleTable(serverFacade, sampleTableId, profile, sampleTypeCode, inspe
 	// Create/Import and other table features
 	//
 	this.createNewSample = function() {
-		mainController.changeView("showCreateSamplePage", this.sampleTypeCode); //TO-DO : Fix global access
+		var $dropdown = FormUtil.getSampleTypeDropdown("sampleTypeDropdown", true);
+		Util.blockUI("Select the type for the sample: <br><br>" + $dropdown[0].outerHTML + "<br> or <a class='btn btn-default' id='sampleTypeDropdownCancel'>Cancel</a>");
+		
+		$("#sampleTypeDropdown").on("change", function(event) {
+			var sampleTypeCode = $("#sampleTypeDropdown")[0].value;
+
+			mainController.changeView("showCreateSamplePage", sampleTypeCode);
+			
+			Util.unblockUI();
+			mainController.changeView("showCreateSubExperimentPage", argsMapStr);
+		});
+		
+		$("#sampleTypeDropdownCancel").on("click", function(event) { 
+			Util.unblockUI();
+		});
 	}
 	
 	this.registerSamples = function() {
-- 
GitLab