Skip to content

Commit

Permalink
fix the bug of mixing the section filters because this.element was th…
Browse files Browse the repository at this point in the history
…e container not the filters section blocks
  • Loading branch information
syphax-bouazzouni committed Oct 22, 2024
1 parent f7b131c commit de13f56
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions app/javascript/controllers/browse_filters_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export default class extends Controller {
filter = "private_only"
break;
default:
checks = this.#getSelectedChecks().map(x => x.value)
checks = this.#getSelectedChecks(event).map(x => x.value)
filter = event.target.name
}

this.#dispatchEvent(filter, checks)
event.stopPropagation()
}

federationChange(event){
Expand All @@ -69,11 +69,10 @@ export default class extends Controller {
data: data
}, bubbles: true
});

this.element.dispatchEvent(customEvent);
}
#getSelectedChecks() {
return Array.from(this.element.querySelectorAll('input:checked'))
#getSelectedChecks(event) {
return Array.from(event.currentTarget.querySelectorAll('input:checked'))
}

}
2 changes: 1 addition & 1 deletion app/views/ontologies/browser/browse.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
%div{data: { controller: "turbo-frame history browse-filters" , "turbo-frame-url-value": "/ontologies_filter?page=1&#{request.original_url.split('?').last}", action: "change->browse-filters#dispatchFilterEvent changed->history#updateURL changed->turbo-frame#updateFrame"}}

.browse-sub-container
.browse-first-row{data:{action: "change->browse-filters#dispatchFilterEvent changed->history#updateURL"}}
.browse-first-row
%div.pt-1
= upload_ontology_button
%div{style:'margin-top: 30px'}
Expand Down

0 comments on commit de13f56

Please sign in to comment.