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 collapsable section for option groups #736
Conversation
|
Please let me know if there is anything I can do to make this merged and published quicker. I'll take a look at the Travis CI failed tests once I am home. |
Example usage:
```javascript
barGroup: # Expanded by default
type: 'object'
title: 'Bar group'
properties:
bar:
title: 'Bar'
description: 'The bar setting'
type: 'boolean'
default: false
bazGroup: # Collapsed by default
type: 'object'
collapsed: true # field to force collapse a grouped setting
properties:
baz:
title: 'Baz'
description: 'The baz setting'
type: 'boolean'
default: false
```
|
I have added tests and the ability to force a grouped setting to be collapsed by default. Example usage: barGroup: # Expanded by default
type: 'object'
title: 'Bar group'
properties:
bar:
title: 'Bar'
description: 'The bar setting'
type: 'boolean'
default: false
bazGroup: # Collapsed by default
type: 'object'
collapsed: true # field to force collapse a grouped setting
properties:
baz:
title: 'Baz'
description: 'The baz setting'
type: 'boolean'
default: false |
Waiting on Atom/settings-view support: atom/settings-view#736
|
@simurai do you have feelings about this? |
|
With many groups, what about a "Collapse/expand all sections" (like the styleguide has)... |
I'll look into that, too. Good idea. Thanks. |
|
The failing test on Travis CI is not influenced by my changes and only happens intermittently. |
|
Please restart the Travis CI build to see that the tests do pass. Someone should probably fix whatever is causing the timeout error: |
|
I think it's great. Maybe not relevant for most packages, but looking at Should the "Collapse All Sections" button be an "Expand All Sections" button instead. For In that case, the button could be disabled, once everything is expanded. Some packages might start to show the most essential settings ungrouped and then a collapsed "Advanced settings" group that is a bit more hidden for less common settings. I think that would be a nice pattern. |
|
I have work and a midterm to study for so it is unlikely I will be making any changes until at the earliest Thursday night. That gives everyone some time to chime in, discuss, and settle on exactly what they want so that this can be reviewed and merged ASAP. Questions to answer/decide:
Thank you. |
|
Any review of this pull request? Is there anything that needs to be changed before this can be merged? Thank you. |
|
Any status on review of this pull request? I know there are at least many Atom Beautify users who are excited for this. Thanks in advance for merging |
|
This is the same as how it is implemented in the Styleguide. It also shows "Collapse All Sections" when all sections are already collapsed: Clicking "Collapse All Sections" toggles the individual I think that while the "Collapse" / "Expand" functionality is a good idea, since other views, such as Stlyeguide, already have a simpler "Collapse All Sections" functionality that this should be a separate Issue. If we want "Collapse" / "Expand" then that should be another Pull Request specifically targeting the overall functionality of Collapsing and add support for Expanding. If this is still a large concern, then I would be forced to suggest that we remove the "Collapse All Sections" button in this Pull Request all together and someone can commit the "Collapse" / "Expand" functionality on their own. This Pull Request is specifically targeting the collapsable sub-sections for within Settings views. The "Collapse All Sections" button was a nice-to-have that I thought would help create excitement and encourage this Pull Request to be closed quicker. However, if that is not the case, then I will promptly remove it in hopes that the core feature, collapsable settings, will be merged promptly.
See #736 (comment) for screenshot. |
|
Please let me know if I should make a new Pull Request with only the |
|
+1 |
|
The Styleguide doesn't necessarily have to serve as the blueprint for this. I think over time the list became too long and then a button got added to collapse everything so you don't have to scroll too much. But personally I would prefer if all the sections in the Styleguide are already collapsed initially.
|
|
Given this Pull Request has taken this long to review, I have simplified it to hopefully make it more appealing so it can be merged sooner. This Pull Request now only adds the following functionality:
Thank goodness for atomic commits and rebasing. |
|
I tested this in the "Editor Settings" to toggle the Invisibles group and it works as expected. Maybe some final |
|
Is there anything else I can do for this issue to be reviewed by those who have merge permission? I thought adding specs passing Travis CI would help expedite this process. Please let me know how else I can help this move along so Atom and Atom Beautify users can benefit. Thank you! |
| @@ -67,7 +70,7 @@ class SettingsPanel extends View | |||
| appendSetting.call(this, namespace, name, settings[name]) | |||
|
|
|||
| sortSettings: (namespace, settings) -> | |||
| _.chain(settings).keys().sortBy((name) -> name).sortBy((name) -> atom.config.getSchema("#{namespace}.#{name}")?.order).value() | |||
| sortSettings(namespace, settings) | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious, why did you move this out into a separate function since it's only used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use sortSettings in two places:
- https://github.com/Glavin001/settings-view/blob/master/lib/settings-panel.coffee#L62
- https://github.com/Glavin001/settings-view/blob/master/lib/settings-panel.coffee#L305
I moved the sortSettings functionality out since I use sortSettings outside of the SettingsPanel class at https://github.com/Glavin001/settings-view/blob/master/lib/settings-panel.coffee#L294-L307
This function could be removed and code changed from @sortSettings to simply calling sortSettings: https://github.com/Glavin001/settings-view/blob/master/lib/settings-panel.coffee#L72-L73
sortSettings: (namespace, settings) ->
sortSettings(namespace, settings)
However, now I look at
settings-view/spec/settings-panel-spec.coffee
Lines 42 to 50 in e9ac721
| sortedSettings = settingsPanel.sortSettings("foo", settings) | |
| expect(sortedSettings[0]).toBe 'zing' | |
| expect(sortedSettings[1]).toBe 'zang' | |
| expect(sortedSettings[2]).toBe 'bar' | |
| expect(sortedSettings[3]).toBe 'gong' | |
| expect(sortedSettings[4]).toBe 'haz' | |
| it "gracefully deals with a null settings object", -> | |
| sortedSettings = settingsPanel.sortSettings("foo", null) |
settingsPanel.sortSettings function.
|
I left one comment otherwise I think it is good to merge. |
|
Could someone restart the Travis CI build? Something appears to have gone wrong. It does not look like it ever reached running the specs. |
|
OK, I really appreciate your patience! This should help with the pathological case of config size without changing the experience of the 99% case. It's just in time to get into the 1.7 beta this week. |
Add collapsable section for option groups
|
Awesome!!! Thank you very much for reviewing and merging. Happy to contribute to Atom. |






About
For a package that has a lot of options, such as
Atom Beautify, it appears to be very difficult for users to find the options they want.I propose that the groups be collapsable.
Features
"Collapse all sections" button (like the styleguide has)Only show "Collapse All" button when there are collapsable sub-sectionsScreenshots
Open

Group 1:Collapsed

Group 1:Options used
/cc #597 Glavin001/atom-beautify#620 Glavin001/atom-beautify#405