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

Add support to read only state. #848

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Conversation

ernaniaz
Copy link

@ernaniaz ernaniaz commented Dec 18, 2019

Merge request checklist

  • [ x ] I read the guidelines for contributing
  • [ x ] I created my branch from dev and I am issuing the PR to dev
  • [ x ] I didn't pushed the dist directory
  • [ x ] Unit tests are OK
  • [ x ] If it's a new feature, I added the necessary unit tests
  • [ x ] If it's a new language, I filled the __locale and __author fields

Pull request summary

This pull request add "read_only" option support to jQuery QueryBuilder core. This option could be changed with "setOptions" call.
When set true, the query will be set read only with a simple overlay. It'll use CSS pointer-events. It's compatible with all browsers except "Opera Mini".
If you think it will fit better as a plugin, please let me know on this request, than I'll request another push with a plugin code.

@mistic100
Copy link
Owner

mistic100 commented Dec 18, 2019

Hello, thank you for your PR.

  • Please respect the general code-style (braces on same line)
  • you can simplify the code in "setOptions" by using toggleClass
  • I don't think it's pertinent to change the opacity of the whole builder. Instead buttons and inputs should be disabled and sort handles (from "sortable" plugin) be hidden. It is less straithforward but will be better for the UX/UI.

@ernaniaz
Copy link
Author

Thanks for your promptly response! I've fixed code-style and changed from CSS overlay to disable any interactive element (also, ignore drag at sortable plugin if readonly).

@mistic100
Copy link
Owner

Ok it's quite straithforward actually (didn't know the :input selector) !

I'll test it soon.

@mistic100 mistic100 added the feature New feature label Dec 18, 2019
@ernaniaz
Copy link
Author

Added some fixes when read_only:

  • At template, add "disabled" tag if read_only;
  • At reset, make sure elements are read_only;
  • At init, added setTimeout() call to wait DOM refresh, otherwise will not add disable property.

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

Successfully merging this pull request may close these issues.

None yet

2 participants