added default_open field to details section of datasets #140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the website these are all using html 'details' sections. We want these to be open if it's the first time a e.g. biosample is being displayed, but be closed if a different section re-references the same biosample.
I think it is easier to store this field in the json rather than try to get Astro's rendering logic work out which sections it has rendered before. This PR adds 'default_open' field to BioSample etc. models for use in the website (named that way because True/False maps directly to the value needed for the html)
This PR doesn't cover Image analysis and correlation sections that are embedded objects in the Dataset json - i will revisit that separately as it's a bit more complex. Also refactored some code into a function because i was having to do the same logic for each of the objects.
Part of: https://app.clickup.com/t/86956nvk4
Astro website PR using this field: BioImage-Archive/BIA-astro#13