Skip to content

Commit f5111e2

Browse files
committedJul 19, 2016
Include 'publish' checkbox
1 parent 07395cd commit f5111e2

File tree

2 files changed

+24
-5
lines changed

2 files changed

+24
-5
lines changed
 

‎generator.html

+19-2
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@
5252

5353
$( INPUTS ).each(function() {
5454
var id = $( this ).attr('id');
55-
var value = $( this ).val();
55+
var value;
56+
if ($( this ).attr('type') == "checkbox") {
57+
value = $( this ).prop( "checked" );
58+
} else {
59+
value = $( this ).val();
60+
}
61+
5662
state[id] = value;
5763
});
5864

@@ -75,7 +81,13 @@
7581
alert("The file that was pasted in the 'metadata.json' box is not valid");
7682
}
7783
$.each( state, function( key, value ) {
78-
$('#' + key).val(value);
84+
$('#' + key).each(function () {
85+
if ($( this ).attr('type') == "checkbox") {
86+
$( this ).prop( "checked", value );
87+
} else {
88+
$( this ).val(value);
89+
}
90+
});
7991
});
8092
return state;
8193
}
@@ -271,6 +283,11 @@ <h2>Dataset Page Fields</h2>
271283

272284
<label for="odi-certificate-number"><strong>Open Data Certificate</strong> (see <a href="https://github.com/openactive/dataset-site-generator/wiki/Open-Data-Certificates">this guide</a>)</label>
273285
<textarea class="pure-input-1" id="odi-certificate-number"></textarea>
286+
287+
<label for="publish" class="pure-checkbox">
288+
<input id="publish" type="checkbox" value="publish">
289+
<strong>Publish</strong> (to <a href="https://www.openactive.io/use-data.html">openactive.io</a>)
290+
</label>
274291
</fieldset>
275292

276293
<br />

‎generator/generator.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ function generate(template, state) {
5050
return template;
5151
}
5252

53-
//Allow this to be required by node
54-
var exports = module.exports = {};
55-
exports.generate = generate;
53+
if ('undefined' !== typeof module) {
54+
//Allow this to be required by node, if server-side
55+
var exports = module.exports = {};
56+
exports.generate = generate;
57+
}

0 commit comments

Comments
 (0)
Please sign in to comment.