mistic100 / mistic100/jQuery-QueryBuilder
Operator selector rendering issue when there is only one operator
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.7k
- Forks
- 544
- PR merge metrics
- No merged PRs in 30d
Description
When a rule has just one operator, both a label and a select is rendered as operator selectors.
This is due to the template:
QueryBuilder.templates.operatorSelect = '
{{? it.operators.length === 1 }}
{{= it.translate("operators", it.operators[0].type) }}
{{?}}
<------- having "else" here would fix the problem
{{ var optgroup = null; }}
{{~ it.operators: operator }}
{{? optgroup !== operator.optgroup }}
{{? optgroup !== null }}{{?}}
{{? (optgroup = operator.optgroup) !== null }}
{{?}}
{{?}}
<option value="{{= operator.type }}" {{? operator.icon}}data-icon="{{= operator.icon}}"{{?}}>{{= it.translate("operators", operator.type) }}
{{~}}
{{? optgroup !== null }}{{?}}
';
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at QueryBuilder.templates.operatorSelect in the template shown in the issue. Review the one-operator conditional and its select rendering, then verify that a rule with one operator shows only the translated label while rules with multiple operators retain the select.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100