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

Make Utils.defineModelProperties() accessible for plugins #608

Closed
wants to merge 1 commit into from

Conversation

attrib
Copy link

@attrib attrib commented Dec 11, 2017

For Standalone Plugins it is not possible to extend existing models. While the main defineModelProperties could be copied, its not possible to get the object itself.

This proposed PR is adding a new method and exposes it, which makes it possible for standalone plugins to add properties to models.

This is done as we do not want to add all dependencies to build the querybuilder to be added to our build environment and want to keep using a standalone plugin. Just makes our life easier ;)

Our plugin is from the UI standpoint very similar to the not-group plugin. Only thing I needed to copy now is some selectors (also not public), but I couldn't work around not being able to add the property to the group model.

If there are ideas how this can be done differently, I'm open for suggestions and would change the PR.

Merge request checklist

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

@mistic100
Copy link
Owner

mistic100 commented Dec 11, 2017

What about ?

var QueryBuilder = $.fn.queryBuilder.constructor;
QueryBuilder.utils.defineModelProperties(QueryBuilder.Group, ...);

@attrib
Copy link
Author

attrib commented Dec 12, 2017

omg, awesome. I wasn't aware of this. Makes my life much easier.
I close this PR then, thanks for the help!

@attrib attrib closed this Dec 12, 2017
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.

None yet

2 participants