Skip to content
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
9 changes: 9 additions & 0 deletions sass/pages/common/PageTree.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@
padding: 0;
}

&__no-drag {
button {
visibility: hidden;
pointer-events: none;
opacity: 0;
cursor: default;
}
}

&__drag-handle {
width: 25px;
height: 25px;
Expand Down
13 changes: 13 additions & 0 deletions src/ui/pages/common/PageTree.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import PageListSearchTable from 'ui/pages/list/PageListSearchTable';
import MovePageModalContainer from 'ui/pages/common/MovePageModalContainer';
import { HOMEPAGE_CODE, PAGE_MOVEMENT_OPTIONS } from 'state/pages/const';


export const getIsRootAndVirtual = (page, virtualRootOn) => {
if (!page) {
return false;
Expand All @@ -28,6 +29,7 @@ export const getIsRootAndVirtual = (page, virtualRootOn) => {
return false;
};


class PageTree extends Component {
constructor(props) {
super(props);
Expand All @@ -49,6 +51,7 @@ class PageTree extends Component {
onExpandAll,
onCollapseAll,
onExpandPage,
virtualRootOn,
} = this.props;

const columnDefs = {
Expand Down Expand Up @@ -108,9 +111,17 @@ class PageTree extends Component {
},
cellAttributes: ({ row: page }) => {
const className = ['PageTree__tree-column-td'];

// Remove arrow from page with no child
// if (page.isEmpty || page.original.isEmpty) {
if (page.isEmpty) {
className.push('PageTree__tree-column-td--empty');
}
// No drag class is added if first level child and Virtual Root On
if (page.original.parentCode === HOMEPAGE_CODE && virtualRootOn) {
className.push('PageTree__no-drag');
}

return { className: className.join(' ') };
},
},
Expand Down Expand Up @@ -282,6 +293,7 @@ PageTree.propTypes = {
columnOrder: PropTypes.arrayOf(PropTypes.string),
myGroupIds: PropTypes.arrayOf(PropTypes.string),
virtualRootOn: PropTypes.bool,
getIsVirtualRootOn: PropTypes.bool,
};

PageTree.defaultProps = {
Expand All @@ -295,6 +307,7 @@ PageTree.defaultProps = {
columnOrder: ['title', 'status', 'displayedInMenu'],
myGroupIds: [],
virtualRootOn: false,
getIsVirtualRootOn: false,
};

export default PageTree;