Implement Tom's emailed suggestions

This commit is contained in:
2018-11-26 22:34:06 +00:00
parent aac22da18c
commit 04b8ae7bf9
3 changed files with 133 additions and 118 deletions

View File

@ -63,6 +63,10 @@
return elem => elem.value === condition
}
function isNot(condition) {
return elem => elem.value !== condition
}
// Returns a function that returns true if its parameter is in `conditions`
function isOneOf(conditions) {
return elem => conditions.includes(elem.value)
@ -84,7 +88,7 @@
// Technical/economic tab
{
control: 'sector_of_economy',
showHide: '#power_generation_questions',
showHide: '.power_generation_questions',
visible: isJust('RN') // Energy generation project
},
{
@ -95,29 +99,29 @@
{
control: 'sector_of_economy',
showHide: '#power_grids_energy_storage_questions',
visible: isJust('PG') // Energy networks or storage (stands for 'power grid')
showHide: '.energy_network_questions',
visible: isJust('PG') // Energy networks (PG = power grid)
},
{
control: 'power_technology',
showHide: '#div_id_power_technology_other',
visible: isJust('OT')
},
{
control: 'power_technology',
showHide: '#div_id_energy_storage_capacity',
visible: isOneOf(['ES', 'OT']) // Storage / other
},
{
control: 'power_technology',
showHide: '#div_id_energy_transmission_capacity',
visible: isOneOf(['PT', 'HN', 'OT']) // Transmission / heat / other
},
{
control: 'sector_of_economy',
showHide: '.energy_storage_questions',
visible: isJust('ST') // Storage
},
{
control: 'sector_of_economy',
showHide: '.energy_generation_network_and_storage_questions',
visible: isOneOf(['RN', 'ST', 'PG']) // Generation (RN), Storage (ST) and networks (PG)
},
{
control: 'sector_of_economy',
showHide: '#mineral_commodity_questions',
showHide: '.mineral_commodity_questions',
visible: isJust('SM') // mining
},
{
@ -128,12 +132,22 @@
{
control: 'sector_of_economy',
showHide: '#manufacturing_questions',
showHide: '.manufacturing_questions',
visible: isJust('MA') // manufacturing
},
// Socio-environmental tab
{
control: 'positive_or_negative',
showHide: '#div_id_positive_case_type',
visible: isNot('N')
},
{
control: 'positive_or_negative',
showHide: '#div_id_negative_case_reasons',
visible: isNot('P')
},
{
control: 'positive_or_negative',
showHide: '#div_id_obstacles_and_hindrances',