Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Associate categories inputs with their parents in selecting/deselecting #773

Conversation

Bilelkihal
Copy link
Collaborator

@Bilelkihal Bilelkihal commented Oct 10, 2024

PR description

This PR updates the category selection logic to ensure that:

  • Selecting a parent select all children
  • Deselecting a parent deselect all the children

Demo

Enregistrement.de.l.ecran.2025-01-02.a.16.40.48.mov

This behavior is implemented in the following features

  • Browse page ✅
  • Upload Ontology Form ✅
  • Edit Submission Form ✅

@Bilelkihal Bilelkihal self-assigned this Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: Select children of category when selecting it Feature: Associate categories and children in inputs Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: Associate categories and children in inputs Feature: Associate categories and children inputs in Browse, Upload ontology and edit submission pages Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: Associate categories and children inputs in Browse, Upload ontology and edit submission pages Feature: Auto-select/deselect child categories when selecting/deselecting parent category Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: Auto-select/deselect child categories when selecting/deselecting parent category Feature: associate Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: associate Feature: Associate categories input with their parents in selecting/deselection Oct 10, 2024
@Bilelkihal Bilelkihal changed the title Feature: Associate categories input with their parents in selecting/deselection Feature: Associate categories inputs with their parents in selecting/deselection Oct 10, 2024
…d when selected and deselect children of parent when deselected
@Bilelkihal
Copy link
Collaborator Author

@syphax-bouazzouni
This PR is based on the branch from PR #772. Once that PR is merged, the number of files in this PR will be reduced.

@jonquet
Copy link

jonquet commented Oct 11, 2024

C'est super bravo.

@Bilelkihal Bilelkihal changed the title Feature: Associate categories inputs with their parents in selecting/deselection Feature: Associate categories inputs with their parents in selecting/deselecting Oct 11, 2024
@syphax-bouazzouni syphax-bouazzouni marked this pull request as draft October 16, 2024 21:17
@syphax-bouazzouni syphax-bouazzouni marked this pull request as ready for review November 1, 2024 19:45
@syphax-bouazzouni syphax-bouazzouni self-requested a review November 1, 2024 19:47
Copy link
Collaborator

@syphax-bouazzouni syphax-bouazzouni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to resolve the conflicts and do the old changes request

@Bilelkihal
Copy link
Collaborator Author

@syphax-bouazzouni I added it to the upload and edit ontology forms,
and resolved all the conflicts with the federation categories refresh code.

Ready to be merged now.

@Bilelkihal
Copy link
Collaborator Author

We need to change the behavior in the browse page to be:

  • Selecting a parent select all children
  • Deselecting a parent deselect all the children

@syphax-bouazzouni
Copy link
Collaborator

@Bilelkihal what is the state of this? will it be abandoned or adapted or is it already good to be merged?
If abandoned you can close it.
If need to be adapted transform it into a draft.
If ready to be merged I will do the review.

@Bilelkihal Bilelkihal marked this pull request as draft November 28, 2024 15:19
@jonquet
Copy link

jonquet commented Dec 1, 2024

To my knowledge we were waiting for the federation to be activated and the new features related to categories assessed before enabling this.

@syphax-bouazzouni syphax-bouazzouni mentioned this pull request Dec 18, 2024
12 tasks
… to select or deselect children with their parents
@Bilelkihal Bilelkihal marked this pull request as ready for review January 2, 2025 15:08
@Bilelkihal
Copy link
Collaborator Author

@syphax-bouazzouni Ready for review

@@ -130,12 +130,14 @@ def ontology_categories_input(ontology = @ontology, categories = @categories)
categories ||= LinkedData::Client::Models::Category.all(display_links: false, display_context: false)

render Input::InputFieldComponent.new(name: '', label: 'Categories') do
content_tag(:div, class: 'upload-ontology-chips-container') do
content_tag(:div, class: 'upload-ontology-chips-container', 'data-controller': 'parent-categories-selector', 'data-parent-categories-selector-categories-value': "#{categories.to_json}", 'data-parent-categories-selector-target': "chips") do
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you pass here "#{categories.to_json}", in the code you need only the children categories of the clicked chip category.

Said otherwise move the logic from the controller js to Ruby

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, but also the logic of categories is changed since the time I created this PR, so I need to adapt it to the changes done before merging

@Bilelkihal
Copy link
Collaborator Author

@syphax-bouazzouni This PR is ready to be merged

@syphax-bouazzouni syphax-bouazzouni merged commit 69402c5 into development Jan 3, 2025
3 of 4 checks passed
@Bilelkihal
Copy link
Collaborator Author

We did a mistake here:
The logic of selecting categories in upload and edit form need to be inversed comparing to the one of the browse page,
in the browse page:
selecting a parent should select the children

but in the attribution of categories in upload or edit forms:
selecting a child should select the parents of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants