Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Merge pull request #1043 from metasfresh/dev-1009
Browse files Browse the repository at this point in the history
Window Name missing in Action Menu #1009
  • Loading branch information
cadavre authored Jul 18, 2017
2 parents bb46b39 + 78dece8 commit 553a5a5
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/components/header/SubHeader.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {connect} from 'react-redux';
import onClickOutside from 'react-onclickoutside';
import counterpart from 'counterpart';

import {updateBreadcrumb} from '../../actions/MenuActions';
import {updateBreadcrumb, elementPathRequest} from '../../actions/MenuActions';

import Actions from './Actions';

Expand All @@ -17,12 +17,19 @@ class Subheader extends Component {
super(props);

this.state = {
pdfSrc: null
pdfSrc: null,
elementPath: ''
}
}

componentDidMount() {
document.getElementsByClassName('js-subheader-column')[0].focus();

elementPathRequest('window', this.props.windowType).then(response => {
this.setState({
elementPath: response.data
});
});
}

handleKeyDown = (e) => {
Expand Down Expand Up @@ -121,6 +128,10 @@ class Subheader extends Component {
handleEditModeToggle, handleEmail
} = this.props;

const {
elementPath
} = this.state;

const docLinks = dataId && [
<div
key={0}
Expand Down Expand Up @@ -177,9 +188,8 @@ class Subheader extends Component {
</div>
]

const currentNode = breadcrumb &&
breadcrumb[breadcrumb.length - 1] &&
breadcrumb[breadcrumb.length - 1].children;
const currentNode = elementPath &&
elementPath.children[elementPath.children.length-1];

return (
<div
Expand All @@ -195,8 +205,12 @@ class Subheader extends Component {
transparentBookmarks={!!siteName}
updateData={this.handleUpdateBreadcrumb}
>
<span className="subheader-title">
{currentNode ? currentNode.caption : siteName}
<span
title={
currentNode ? currentNode.caption : siteName
}
className="subheader-title">
{currentNode ? currentNode.caption : siteName}
</span>
</BookmarkButton>
</div>
Expand Down

0 comments on commit 553a5a5

Please sign in to comment.