Commit a78d3792 authored by Ryan Herbert's avatar Ryan Herbert

display set forms inline

makes better use of space for adding multiple patients/runs/sets in a
single form.
parent 4587265f
......@@ -2282,10 +2282,14 @@ fieldset {
width: -moz-available;
}
form label {
display: inline-block;
width: 100px;
text-align: right;
form {
label {
display: inline-block;
text-align: right;
}
div.field_div {
display: inline-block;
}
}
.clear {
......
......@@ -22,6 +22,12 @@ function FormBuilder() {
FormBuilder.prototype = {
build_wrapper: function() {
var d = document.createElement('div');
d.className = "field_div";
return d;
},
build_label: function(txt, stype, tgt) {
var l = document.createElement('label');
l.htmlFor = tgt + "_" + this.index;
......@@ -53,7 +59,7 @@ FormBuilder.prototype = {
label = labelise(id);
}
var d = document.createElement('div');
var d = this.build_wrapper();
d.appendChild(this.build_label(label, this.type, id));
d.appendChild(this.build_input(id, 'string', name, 'text', this.type));
return d;
......@@ -98,14 +104,17 @@ SetFormBuilder.prototype.date = function(id, name, label) {
label = labelise(id);
}
var d = document.createElement('div');
var d = this.build_wrapper();
d.appendChild(this.build_label(label, this.type, id));
d.appendChild(this.build_input(id, 'date', name, 'text', this.type, 'yyyy-mm-dd'));
var i = this.build_input(id, 'date', name, 'text', this.type, false, 'yyyy-mm-dd');
i.pattern = "[0-9]{4}-[0-9]{2}-[0-9]{2}";
i.title = "yyyy-mm-dd"
d.appendChild(i);
return d;
};
SetFormBuilder.prototype.info = function() {
var d = document.createElement('div');
var d = this.build_wrapper();
var id = 'info';
d.appendChild(this.build_label('Info', this.type, id));
......
......@@ -4,12 +4,12 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{pass}}
<div>
<div class="field_div">
<label for="sample_set_name_{{=i}}" id="sample_set_name__label_{{=i}}">Name: </label>
<input class="string" id="sample_set_name_{{=i}}" name="generic[{{=i}}][name]" type="text"
value="{{if set is not None:}}{{=set['name']}}{{pass}}"><span>*</span>
</div>
<div>
<div class="field_div">
<label for="sample_set_info_{{=i}}" id="sample_set_info__label_{{=i}}">Info: </label>
<textarea
onfocus="$(this).data('group-ids', [$('#group_select option:selected').val()]);
......
......@@ -4,27 +4,27 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{ pass }}
<div>
<div class="field_div">
<label for="patient_id_label_{{=i}}" id="patient_id_label__label_{{=i}}">Patient ID: </label>
<input class="date" id="patient_id_label_{{=i}}" name="patient[{{=i}}][id_label]" type="text"
value="{{if set is not None and set['id_label'] is not None:}}{{=set['id_label']}}{{pass}}"><span></span>
</div>
<div>
<div class="field_div">
<label for="patient_first_name_{{=i}}" id="patient_first_name__label_{{=i}}">First Name: </label>
<input class="string" id="patient_first_name_{{=i}}" name="patient[{{=i}}][first_name]" type="text"
value="{{if set is not None:}}{{=set['first_name']}}{{pass}}"><span>*</span>
</div>
<div>
<div class="field_div">
<label for="patient_last_name_{{=i}}" id="patient_last_name__label_{{=i}}">Last Name: </label>
<input class="string" id="patient_last_name_{{=i}}" name="patient[{{=i}}][last_name]" type="text"
value="{{if set is not None:}}{{=set['last_name']}}{{pass}}"><span>*</span>
</div>
<div>
<div class="field_div">
<label for="patient_birth_{{=i}}" id="patient_birth__label_{{=i}}">Birth: </label>
<input class="date" id="patient_birth_{{=i}}" name="patient[{{=i}}][birth]" type="text"
value="{{if set is not None and set['birth'] is not None:}}{{=set['birth']}}{{pass}}" placeholder="yyyy-mm-dd">
</div>
<div>
<div class="field_div">
<label for="patient_info_{{=i}}" id="patient_info__label_{{=i}}">Info: </label>
<textarea
onfocus="$(this).data('keys', [$('#group_select option:selected').val()]);
......
......@@ -4,22 +4,22 @@
{{ if set is not None and 'error' in set and len(set['error']) > 0: }}
<div class="error">error: {{=", ".join(set['error'])}}</div>
{{ pass }}
<div>
<div class="field_div">
<label for="run_id_label_{{=i}}" id="run_id_label__label_{{=i}}">Run ID: </label>
<input class="date" id="run_id_label_{{=i}}" name="run[{{=i}}][id_label]" type="text"
value="{{if set is not None and set['id_label'] is not None:}}{{=set['id_label']}}{{pass}}"><span></span>
</div>
<div>
<div class="field_div">
<label for="run_name_{{=i}}" id="run_name__label_{{=i}}">Name: </label>
<input class="string" id="run_name_{{=i}}" name="run[{{=i}}][name]" type="text"
value="{{if set is not None:}}{{=set['name']}}{{pass}}"><span>*</span>
</div>
<div>
<div class="field_div">
<label for="run_date_{{=i}}" id="run_date__label_{{=i}}">Date: </label>
<input class="date" id="run_date_{{=i}}" name="run[{{=i}}][run_date]" type="text"
value="{{if set is not None and set['run_date'] is not None:}}{{=set['run_date']}}{{pass}}" placeholder="yyyy-mm-dd">
</div>
<div>
<div class="field_div">
<label for="run_info_{{=i}}" id="run_info__label_{{=i}}">Info: </label>
<textarea
onfocus="$(this).data('group-ids', [$('#group_select option:selected').val()]);
......@@ -31,12 +31,12 @@
name="run[{{=i}}][info]"
rows="10">{{if set is not None and set['info'] is not None:}}{{=set['info']}}{{pass}}</textarea>
</div>
<div>
<div class="field_div">
<label for="run_sequencer_{{=i}}" id="run_sequencer__label_{{=i}}">Sequencer: </label>
<input id="run_sequencer_{{=i}}" name="run[{{=i}}][sequencer]" type="text" size="40"
value="{{if set is not None and set['sequencer'] is not None:}}{{=set['sequencer']}}{{pass}}">
</div>
<div>
<div class="field_div">
<label for="run_pcr_{{=i}}" id="pcr__label_{{=i}}">PCR </label>
<input id="run_pcr_{{=i}}" name="run[{{=i}}][pcr]" type="text" size="40"
value="{{if set is not None and set['pcr'] is not None:}}{{=set['pcr']}}{{pass}}">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment