Skip to content

Collapsible groups #534

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

Closed
wants to merge 13 commits into from
Closed

Collapsible groups #534

wants to merge 13 commits into from

Conversation

jvincilione
Copy link

@jvincilione jvincilione commented Jul 24, 2017

…-list.

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

Looks like this solves #347

@jvincilione
Copy link
Author

@mistic100 It looks like travis failed due to an error installing sass

Error installing sass:
	sass requires Ruby version >= 2.0.0.

@mistic100
Copy link
Owner

mistic100 commented Jul 24, 2017

I will change grunt-contrib-sass to grunt-sass during the week. In order to use node-sass and remove the dependency to Ruby.

Nice effort though, this kind of error with Travis always bothers me.

@mistic100
Copy link
Owner

mistic100 commented Jul 25, 2017

@jvincilione I switched everything to node-sass 81175dd
please rebase your branch

@jvincilione
Copy link
Author

Nice, looks like everything passed!

@mistic100
Copy link
Owner

Why did you merged your own branch into itself ? When doing a rebase you have to do a force push, instead you get this horrible history.

You can also use interractive rebase to squash your commits.

@jvincilione
Copy link
Author

Sorry, I'll try and fix it. The merge happened because it wouldn't let me push without pulling down first. I'm not all that familiar with Rebase.

@jvincilione
Copy link
Author

Fixed it. Sorry for the trouble.

@jvincilione
Copy link
Author

Added naming support #535

Copy link
Owner

@mistic100 mistic100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/public.js Outdated
@@ -237,6 +237,14 @@ QueryBuilder.prototype.getRules = function(options) {
groupData.data = $.extendext(true, 'replace', {}, group.data);
}

if (typeof group.collapsed !== 'undefined') {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code must no be in the core. use the groupToJson event from the plugin

@jvincilione
Copy link
Author

Made the changes. Let me know if there are any other issues.

@jvincilione
Copy link
Author

jvincilione commented Aug 3, 2017

@mistic100 Found a bug with loading regarding the collapse stuff and fixed it. Let me know if there is anything else you want me to do here...

@mistic100
Copy link
Owner

Yes i have other reviews. Sorry for taking so long, my free time is sparse.

});

// Modify templates
this.on('getGroupTemplate.filter', function(h, level) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for performances, merge the two handlers, and but the "if" here

* Save the entered group name on the group object
* @param {jQuery Element} [$el]
*/
setGroupName: function($el) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should be in the event handler directly, the function itself is useless.

* @param {jQuery Element} [$el]
* @param {object} [options] {@link module:plugins.Collapse}
*/
collapse: function($el, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first parameter should be a Group object.

* @param {jQuery Element} [$el]
* @param {object} [options] {@link module:plugins.Collapse}
*/
collapse: function($el, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method should be named toggleGroup

* @param {jQuery Element} [$el]
* @param {object} [options] {@link module:plugins.Collapse}
*/
collapse: function($el, options) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of having to pass the options use this.getPluginOptions('collapse-group')


// Collapse any groups that were saved as collapsed
this.on('afterSetRules', function() {
$.each($(Selectors.group_container), function(i, el) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You iterate over ALL groups of ALL builders in the page, this will break.

use this.getModel().each() instead which iterates over the builder model (see to jsdoc for recursive traversal)

* @param {object} [options] {@link module:plugins.Collapse}
*/
collapse: function($el, options) {
var self = this;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused

self.collapse($(el).find('[data-collapse="group"]'), options);
}
if (group.name) {
$(el).find('.group-name').val(group.name);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code should not be here, remove it and use a model event

this.model.on('update', function(e, node, field, value) {
  if (node instanceof Group && field === 'name') {
    node.$el.find('.group-name').val(node.name);
  }
});

namedGroups: true
});

/**
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be separated in two distinct comments blocks for proper doc generation

* @param {object} [options]
* @param {string} [options.iconUp='glyphicon glyphicon-chevron-up']
* @param {string} [options.iconDown='glyphicon glyphicon-chevron-down']
*/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing namedGroups doc

@mistic100
Copy link
Owner

@jvincilione Sorry the review was not published, I didn't see it because the behavior changed some months ago

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.

2 participants