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

Fix broken pane toggle #613

Merged
merged 3 commits into from
Oct 6, 2016
Merged

Conversation

green3g
Copy link
Member

@green3g green3g commented Oct 5, 2016

Panes are not toggleable by the button since #607

Copy link
Contributor

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Good catch! This approach (accepting arbitrary input and toggling if it isn't something we recognize) should conflate the last two else if/else conditions since they are logically identical.

Alternatively, to keep the strict togglePane API which only accepts reasonable 'show' arguments I would suggest instead changing line 182 from on(this.collapseButtons[key], 'click', lang.hitch(this, 'togglePane', key)); to on(this.collapseButtons[key], 'click', lang.hitch(this, 'togglePane', key, null, false)); and line 231 from } else if (show === undefined) { to } else if (show === undefined || show === null) {.

Either technically works, I leave the choice of which approach is preferred up to the maintainers.

error: 'Invalid type passed as "show" property of "togglePane" function : ' + typeof(show)
});
return;
newDisp = (domStyle.get(domNode, 'display') === 'none') ? 'block' : 'none';
Copy link
Contributor

@amcgee amcgee Oct 5, 2016

Choose a reason for hiding this comment

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

This is logically identical to the above case, so if we want to accept arbitrary input for the 'show' parameter we should just remove this error condition and change the else if (show === undefined) case to else

@green3g
Copy link
Member Author

green3g commented Oct 5, 2016

Agreed, I like the second approach:

on(this.collapseButtons[key], 'click', lang.hitch(this, 'togglePane', key, null, false));

@tmcgee
Copy link
Member

tmcgee commented Oct 5, 2016

I like the second approach as well.

For consistency, the suppressEvents parameter should also be passed to togglePane method in the response to the topic viewer/togglePane.

@amcgee
Copy link
Contributor

amcgee commented Oct 5, 2016

Agreed!

@green3g
Copy link
Member Author

green3g commented Oct 5, 2016

Just noticed, you guys both have the same last names...are you related? 😃

@green3g green3g force-pushed the fix-broken-pane-toggle branch 2 times, most recently from f6e7844 to 942117b Compare October 5, 2016 16:17
@tmcgee
Copy link
Member

tmcgee commented Oct 5, 2016

@roemhildtg can you also add the additional argument here.

@DavidSpriggs
Copy link
Member

@amcgee merge base branch. thanks guys!

@tmcgee
Copy link
Member

tmcgee commented Oct 6, 2016

^^^ @roemhildtg that comment is for you. Hoping you can also include the request in my comment.

@DavidSpriggs
Copy link
Member

yep! sorry @roemhildtg my bad, thanks!

@green3g
Copy link
Member Author

green3g commented Oct 6, 2016

Sorry! So just to be sure, that should be changed to this.togglePane(args.pane, args.show, false); correct? Since we dont want to suppress the event?

@tmcgee
Copy link
Member

tmcgee commented Oct 6, 2016

@roemhildtg how about passing args.suppressEvents?

@green3g
Copy link
Member Author

green3g commented Oct 6, 2016

Okay, gotcha.

@tmcgee tmcgee merged commit 3d12b9a into cmv:develop Oct 6, 2016
@tmcgee tmcgee added the bug label Oct 6, 2016
@tmcgee tmcgee added this to the v2.0.0-beta.1 milestone Oct 6, 2016
@green3g green3g deleted the fix-broken-pane-toggle branch October 7, 2016 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants