Adds support for adding contains operator to genres rule. Now you can dogenres in [multi-select] and genres in [input]. Support for the latter is what this commit adds.
Solves #60 .
Happy path working:
The only bug I'm aware of (on edit page). See more details below the video:
When you edit a playlist with a contains rule, it renders it with the operator on in (with the select dropdown), then switches to contains without firing any events (as far as I can tell). Very annoying. Simplest way to fix it is probably to call $("#builder").trigger('afterUpdateRuleOperator.queryBuilder', rule) after the page loads. That would auto-trigger the event handler and everything should re-render properly.
Or in the rails template logic you could check for a "contains" rule for genres, and switch the genres filter config before the client side code runs.
This was a fun project. Would love to fix the bug, but it's been about 10 hrs and I need to step away from this.
First 2 hours was just getting re-acclimated to Rails & jQuery (it's been about 10 years). Other 8 hours was looking at various ways to make queryBuilder do what it didn't want to do. It basically fought me the whole time.
Adds support for adding
contains
operator to genres rule. Now you can dogenres in [multi-select]
andgenres in [input]
. Support for the latter is what this commit adds.Solves #60 .
Happy path working:
The only bug I'm aware of (on edit page). See more details below the video: When you edit a playlist with a
contains
rule, it renders it with the operator onin
(with the select dropdown), then switches tocontains
without firing any events (as far as I can tell). Very annoying. Simplest way to fix it is probably to call$("#builder").trigger('afterUpdateRuleOperator.queryBuilder', rule)
after the page loads. That would auto-trigger the event handler and everything should re-render properly. Or in the rails template logic you could check for a "contains" rule for genres, and switch the genres filter config before the client side code runs.This was a fun project. Would love to fix the bug, but it's been about 10 hrs and I need to step away from this.
First 2 hours was just getting re-acclimated to Rails & jQuery (it's been about 10 years). Other 8 hours was looking at various ways to make queryBuilder do what it didn't want to do. It basically fought me the whole time.
I'll leave more comments & details inline.
Related issues for helpful context: https://github.com/mistic100/jQuery-QueryBuilder/issues/688 https://github.com/mistic100/jQuery-QueryBuilder/issues/284
https://github.com/mistic100/jQuery-QueryBuilder/issues/688#issuecomment-385454539 is basically the technique I used but he's very vague with how to set up and tear down the plugins.