1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-22 19:07:54 +01:00

Slugify tab anchors. Closes #77.

This commit is contained in:
Jari Bakken 2015-01-26 12:47:26 +01:00 committed by Ivar Conradi Østhus
parent a778f6c660
commit 8a8f157841
2 changed files with 9 additions and 5 deletions

View File

@ -8,19 +8,23 @@ var ArchiveFeatureComponent = React.createFactory(require('./components/feature/
var tabPanes = [
{
name: "Feature Toggles",
name: 'Feature Toggles',
slug: 'feature-toggles',
content: new FeatureTogglesComponent({pollInterval: 5000})
},
{
name: "Strategies",
name: 'Strategies',
slug: 'strategies',
content: new StrategiesComponent({})
},
{
name: "Log",
slug: 'log',
content: new LogEntriesComponent({})
},
{
name: "Archive",
slug: 'archive',
content: new ArchiveFeatureComponent({})
}
];

View File

@ -12,7 +12,7 @@ var TabView = React.createClass({
if(userHash) {
userHash = userHash.split("#")[1];
this.props.tabPanes.forEach(function(pane) {
if(pane.name === userHash) {
if(pane.slug === userHash) {
activeTab = pane;
}
}.bind(this));
@ -28,8 +28,8 @@ var TabView = React.createClass({
render: function() {
var tabNodes = this.props.tabPanes.map(function (tabPane) {
return (
<li key={tabPane.name} className={tabPane.name===this.state.activeTab.name ? "active": ""}>
<a href={"#" + tabPane.name}
<li key={tabPane.name} className={tabPane.name === this.state.activeTab.name ? "active": ""}>
<a href={"#" + tabPane.slug}
onClick={this.onChangeTab.bind(this, tabPane)}>{tabPane.name}
</a>
</li>