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

Slugify tab anchors. Closes #77.

This commit is contained in:
Jari Bakken 2015-01-26 12:47:26 +01:00
parent c33852010b
commit b188f42292
2 changed files with 9 additions and 5 deletions

View File

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

View File

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