diff interfaces/discrete.js @ 1295:ba8c8c7f1de5

Bug #1652 and Feature #1650 fixes. You can specify the track labels through page attribute 'label' ('default', 'none', 'number', 'letter', 'capital'). Updated examples to match schema
author Nicholas Jillings <nickjillings@users.noreply.github.com>
date Thu, 10 Mar 2016 16:16:16 +0000
parents 175cf75946f7
children ba6b9e1aaef5
line wrap: on
line diff
--- a/interfaces/discrete.js	Thu Mar 10 15:33:39 2016 +0000
+++ b/interfaces/discrete.js	Thu Mar 10 16:16:16 2016 +0000
@@ -55,7 +55,7 @@
 	};
 	// Create Submit (save) button
 	var submit = document.createElement("button");
-	submit.innerHTML = 'Submit';
+	submit.innerHTML = 'Next';
 	submit.onclick = buttonSubmitClick;
 	submit.id = 'submit-button';
 	submit.style.float = 'left';
@@ -184,7 +184,7 @@
 	});
 	
 	// Find all the audioElements from the audioHolder
-	var label = 0;
+	var index = 0;
 	var interfaceScales = testState.currentStateMap.interfaces[0].scales;
 	$(page.audioElements).each(function(index,element){
 		// Find URL of track
@@ -198,11 +198,25 @@
 			audioObject.bindInterface(orNode);
 		} else {
 			// Create a slider per track
+            switch(audioObject.specification.parent.label) {
+                case "none":
+                    label = "";
+                    break;
+                case "letter":
+                    label = String.fromCharCode(97 + index);
+                    break;
+                case "capital":
+                    label = String.fromCharCode(65 + index);
+                    break;
+                default:
+                    label = ""+index;
+                    break;
+            }
 			var sliderObj = new discreteObject(audioObject,label,interfaceScales);
 			sliderBox.appendChild(sliderObj.holder);
 			audioObject.bindInterface(sliderObj);
             interfaceContext.commentBoxes.createCommentBox(audioObject);
-			label += 1;
+			index += 1;
 		}
         
 	});