Through row 116
This commit is contained in:
@ -301,16 +301,10 @@ dd ul { padding-left: 0; margin-left: 0; }
|
||||
{{ case_study.energy_storage_capacity }} TODO UNITS?
|
||||
{% endif %}
|
||||
|
||||
{% if case_study.maximum_power_output %}
|
||||
<dt>{% trans "Maximum power output" %}:
|
||||
<dd id="maximum_power_output">
|
||||
{{ case_study.maximum_power_output | intcomma }} W
|
||||
{% endif %}
|
||||
|
||||
{% if case_study.discharge_time %}
|
||||
<dt>{% trans "Time for discharge from full capacity" %}:
|
||||
<dd id="discharge_time">
|
||||
{{ case_study.discharge_time | intcomma }} {% trans "seconds" %}
|
||||
{% if case_study.energy_transmission_capacity %}
|
||||
<dt>{% trans "Energy transmission capacity" %}:
|
||||
<dd id="energy_transmission_capacity">
|
||||
{{ case_study.energy_transmission_capacity }} TODO UNITS?
|
||||
{% endif %}
|
||||
|
||||
{% if case_study.contractor_or_supplier_of_technology %}
|
||||
|
@ -40,6 +40,14 @@
|
||||
|
||||
<!-- Conditional logic for hiding and un-hiding fields. -->
|
||||
<script>
|
||||
function showIf(thingToShow, whetherToShowIt) {
|
||||
if (whetherToShowIt) {
|
||||
$(thingToShow).show()
|
||||
} else {
|
||||
$(thingToShow).hide()
|
||||
}
|
||||
}
|
||||
|
||||
// Here we define the fields we need to conditionally toggle.
|
||||
// TODO: Move this knowledge out of the template
|
||||
var conditionalFields = [
|
||||
@ -102,13 +110,25 @@
|
||||
name: "power_technology",
|
||||
redraw: function() {
|
||||
const other = document.getElementById('id_id_power_technology_0_4')
|
||||
const showHide = document.getElementById('div_id_power_technology_other')
|
||||
const panel = document.getElementById('div_id_power_technology_other')
|
||||
|
||||
if (other.checked) {
|
||||
$(showHide).show();
|
||||
} else {
|
||||
$(showHide).hide();
|
||||
}
|
||||
showIf(panel, other.checked)
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
name: "power_technology",
|
||||
redraw: function() {
|
||||
const group = document.forms['case-study-form'].power_technology
|
||||
|
||||
// Storage / other
|
||||
let showStorage = ['ES', 'OT'].includes(group.value)
|
||||
|
||||
// Transmission / heat / other
|
||||
let showTransmission = ['PT', 'HN', 'OT'].includes(group.value)
|
||||
|
||||
showIf('#div_id_energy_storage_capacity', showStorage)
|
||||
showIf('#div_id_energy_transmission_capacity', showTransmission)
|
||||
}
|
||||
},
|
||||
|
||||
@ -134,11 +154,7 @@
|
||||
const input = document.getElementById(option.input)
|
||||
const section = document.getElementById(option.section)
|
||||
|
||||
if (input.checked) {
|
||||
$(section).show();
|
||||
} else {
|
||||
$(section).hide();
|
||||
}
|
||||
showIf(section, input.checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user