1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-02-14 00:19:16 +01:00

add pageTitle

This commit is contained in:
sveisvei 2016-12-04 15:23:22 +01:00
parent c512345f71
commit 597ed58fe1
2 changed files with 21 additions and 11 deletions

View File

@ -25,6 +25,16 @@ export default class App extends Component {
router: React.PropTypes.object,
}
componentDidMount () {
document.title = `${this.getCurrentSection()} - Unleash Admin`;
}
getCurrentSection () {
const { routes } = this.props;
const lastRoute = routes[routes.length - 1];
return lastRoute ? lastRoute.pageTitle : '';
}
onOverlayClick = () => this.setState({ drawerActive: false });
render () {
@ -39,7 +49,7 @@ export default class App extends Component {
<div style={{}}>
<UserContainer />
<Layout fixedHeader>
<Header title={<span><span style={{ color: '#ddd' }}>Unleash Admin / </span><strong>The Title</strong></span>}>
<Header title={<span><span style={{ color: '#ddd' }}>Unleash Admin / </span><strong>{this.getCurrentSection()}</strong></span>}>
<Navigation>
<a href="https://github.com/Unleash" target="_blank">Github</a>
<ShowUserContainer />

View File

@ -32,16 +32,16 @@ ReactDOM.render(
<Router history={hashHistory}>
<Route path="/" component={App}>
<IndexRedirect to="/features" />
<Route path="/features" component={Features} />
<Route path="/features/create" component={CreateFeatureToggle} />
<Route path="/features/edit/:name" component={EditFeatureToggle} />
<Route path="/strategies" component={Strategies} />
<Route path="/strategies/create" component={CreateStrategies} />
<Route path="/history" component={HistoryPage} />
<Route path="/history/:toggleName" component={HistoryTogglePage} />
<Route path="/archive" component={Archive} />
<Route path="/applications" component={Applications} />
<Route path="/client-strategies" component={ClientStrategies} />
<Route pageTitle="Features" path="/features" component={Features} />
<Route pageTitle="Features" path="/features/create" component={CreateFeatureToggle} />
<Route pageTitle="Features" path="/features/edit/:name" component={EditFeatureToggle} />
<Route pageTitle="Strategies" path="/strategies" component={Strategies} />
<Route pageTitle="Strategies" path="/strategies/create" component={CreateStrategies} />
<Route pageTitle="History" path="/history" component={HistoryPage} />
<Route pageTitle="History" path="/history/:toggleName" component={HistoryTogglePage} />
<Route pageTitle="Archive" path="/archive" component={Archive} />
<Route pageTitle="Applications" path="/applications" component={Applications} />
<Route pageTitle="Client strategies" ppath="/client-strategies" component={ClientStrategies} />
</Route>
</Router>
</Provider>, document.getElementById('app'));