Add toggle switch boolean fields#487
Conversation
There was a problem hiding this comment.
@CelinaKellinghaus This looks great so far! I have no complaints about it :-)
I couldn't really reproduce any issue with moving the code to the scss file - I simply uncommented the code in the file and removed the <style> block from the template and it was working just fine. Then I updated the main.css file by running collectstatic and copy-pasting the updated main.css in cdn_static_root (which was compiled using the scss files) to the one in static.
ff6115f to
f418780
Compare
| padding-left: 0; } } | ||
| /* ----------------------------- open_plan 2 ----------------------------- */ | ||
| /* ----------------------------- open_plan 2 ----------------------------- */ | ||
| form .form-control:focus { |
There was a problem hiding this comment.
Where do these changes to main.css come from? It doesn't seem like these affect only the toggle switch and I also don't see the changes to scss that would be the source for this update.
| guiModalDOM.querySelector('form .modal-body').innerHTML = jsonRes.form_html; | ||
| // make certain to show form | ||
| guiModal.show(); |
There was a problem hiding this comment.
Here, the html form contents of the modal get overwritten if the form is not valid (to dynamically display the field errors). As that is currently always the case for the PV form (to force the user to select a timeseries), the display properties you set before on the fields get overwritten. To make it work, you can call the function again here before displaying the new form
| guiModalDOM.querySelector('form .modal-body').innerHTML = jsonRes.form_html; | |
| // make certain to show form | |
| updateCapacityFieldsVisibility(); | |
| guiModal.show(); |
Boolean form fields (optimize_cap, dispatchable, renewable_asset) are now displayed as toggle switches instead of yes/no dropdowns.
A new "Settings" section was added above the economical parameters to group these fields together.
Note:
Toggle styles in _forms.scss are commented out and not functional yet.
Styles are currently applied inline in the widget.
Fixes #483.