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

Fixes #1752: TOC by level group className #1753

Merged
merged 1 commit into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions web/client/components/TOC/DefaultGroup.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ var DefaultGroup = React.createClass({
style: React.PropTypes.object,
sortableStyle: React.PropTypes.object,
onToggle: React.PropTypes.func,
level: React.PropTypes.number,
onSort: React.PropTypes.func,
propertiesChangeHandler: React.PropTypes.func,
groupVisibilityCheckbox: React.PropTypes.bool,
Expand All @@ -34,20 +35,21 @@ var DefaultGroup = React.createClass({
sortableStyle: {},
propertiesChangeHandler: () => {},
groupVisibilityCheckbox: false,
visibilityCheckType: "glyph"
visibilityCheckType: "glyph",
level: 1
};
},
render() {
let {children, onToggle, ...other } = this.props;
return (
<Node className="toc-default-group" sortableStyle={this.props.sortableStyle} style={this.props.style} type="group" {...other}>
<Node className={"toc-default-group toc-group-" + this.props.level} sortableStyle={this.props.sortableStyle} style={this.props.style} type="group" {...other}>
{ this.props.groupVisibilityCheckbox &&
<VisibilityCheck
key="visibility"
checkType={this.props.visibilityCheckType}
propertiesChangeHandler={this.props.propertiesChangeHandler}/>}
<GroupTitle onClick={this.props.onToggle}/>
<GroupChildren onSort={this.props.onSort} position="collapsible">
<GroupChildren level={this.props.level + 1} onSort={this.props.onSort} position="collapsible">
{this.props.children}
</GroupChildren>
</Node>
Expand Down
7 changes: 5 additions & 2 deletions web/client/components/TOC/fragments/GroupChildren.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const GroupChildren = React.createClass({
propTypes: {
node: React.PropTypes.object,
filter: React.PropTypes.func,
onSort: React.PropTypes.func
onSort: React.PropTypes.func,
level: React.PropTypes.number
},
statics: {
inheritedPropTypes: ['node', 'filter', 'onSort']
Expand All @@ -23,7 +24,8 @@ const GroupChildren = React.createClass({
return {
node: null,
filter: () => true,
onSort: null
onSort: null,
level: 1
};
},
render() {
Expand All @@ -36,6 +38,7 @@ const GroupChildren = React.createClass({
node: node,
key: node.id,
sortData: i++,
level: this.props.level,
isDraggable: !!this.props.onSort
})));
}
Expand Down