euphorie / Euphorie

Euphorie is a tool for risk assessment
https://pythonhosted.org/Euphorie/
GNU General Public License v2.0
11 stars 6 forks source link

Fix selected measure text spanning whole page instead of bein shown in training module. #592

Closed thet closed 1 year ago

thet commented 1 year ago

Ref: scrum-1205 item 2)

reinhardt commented 1 year ago

This seems a bit hacky. Can't we make the injection target depend on whether the training module is displayed?

thet commented 1 year ago

Actually, I would not change this because it works better than expected:

The injection target replaces the whole element: source: #page-module-training::element; target: #page-module-training::element;. When first rendered with no risks selected it is hidden. When a risk is selected and the injection happens the result already does not contain the display:hidden style and the risk module is shown immediately. When unselecting the risk module is hidden immediately.

If we would fiddle with the injection depending on if there are selected risks or not we would only show/hide the risk module on a full reload/injection of the page.

Slightly related: what I found odd is:

1) after selecting a risk a pat-autosubmit initiated POSTs happens and the server responds with the already correct markup. But then another injection happens just to GET the same markup and to inject/replace the risk module (probably due to a second pat-inject defined on the fieldset of the risk checkboxes?).

2) besides of being loaded twice, the whole page is returned, not only relevant parts of it. We could save quite some templating logic if only the relevant parts would be returned. Or - instead of the style="display: none" hack if we could use the CSS :has pseudo selector instead‌ (not yet available in Firefox) and instead of pat-inject we could do a pat-clone for the selected to be cloned into the training module.

pilz commented 1 year ago

Yes but that would complicate the code considerably. There is no funding for making this cleaner. Keep as is.