Skip to content

Commit

Permalink
Fixes #1752: TOC by level group className
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarto committed Apr 20, 2017
1 parent 1f45ca7 commit 9f32047
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit 9f32047

Please sign in to comment.