Commit a4ff1be1525a3a6d65d173c9a8f6b7ad086741d0

Lea Verou 2012-07-30T15:44:37

Download page now enforces restriction of only 1 theme per download

diff --git a/code.js b/code.js
index 2681bf2..4f9c39e 100644
--- a/code.js
+++ b/code.js
@@ -140,9 +140,12 @@ var components = {
 		meta: {
 			path: '{id}.css',
 			link: 'index.html?theme={id}',
+			exclusive: true
+		},
+		'prism': {
+			title: 'Default',
 			option: 'default'
 		},
-		'prism': 'Default',
 		'prism-dark': 'Dark',
 		'prism-funky': 'Funky'
 	},
@@ -222,7 +225,7 @@ for (var id in themes) {
 		properties: {
 			htmlFor: 'theme=' + id
 		},
-		contents: themes[id],
+		contents: themes[id].title || themes[id],
 		inside: p
 	});
 }
diff --git a/download.html b/download.html
index 44b3647..4088790 100644
--- a/download.html
+++ b/download.html
@@ -12,7 +12,7 @@ form label {
 	padding: .2em;
 }
 
-form input[type="checkbox"] {
+form input {
 	margin-right: .7em;
 }
 
diff --git a/download.js b/download.js
index b3af23a..5b93ecc 100644
--- a/download.js
+++ b/download.js
@@ -71,16 +71,17 @@ for (var category in components) {
 			contents: [
 				{
 					tag: 'input',
-					attributes: {
-						'data-id': id
-					},
 					properties: {
-						type: 'checkbox',
+						type: all.meta.exclusive? 'radio' : 'checkbox',
+						name: 'download-' + category,
+						value: id,
 						checked: checked,
 						disabled: disabled,
 						onclick: (function(id, category, all){
 							return function () {
-								all[id].enabled = this.checked;
+								$$('input[name="' + this.name + '"]').forEach(function(input) {
+									all[input.value].enabled = input.checked;
+								});
 								
 								update(category, id);
 							};