From 162136194adabfec70931bcc74f4b0303e45b692 Mon Sep 17 00:00:00 2001 From: Colin McLeod Date: Sat, 18 Jun 2016 19:44:37 -0700 Subject: [PATCH] Add build name to title, Fixes #171 --- src/app/pages/OutfittingPage.jsx | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/app/pages/OutfittingPage.jsx b/src/app/pages/OutfittingPage.jsx index c499db0a..0ac81281 100644 --- a/src/app/pages/OutfittingPage.jsx +++ b/src/app/pages/OutfittingPage.jsx @@ -24,6 +24,16 @@ import Slider from '../components/Slider'; const SPEED_SERIES = ['boost', '4 Pips', '2 Pips', '0 Pips']; const SPEED_COLORS = ['#0088d2', '#ff8c0d', '#D26D00', '#c06400']; +/** + * Document Title Generator + * @param {String} shipName Ship Name + * @param {String} buildName Build Name + * @return {String} Document title + */ +function getTitle(shipName, buildName) { + return `${shipName}${buildName ? ` - ${buildName}` : ''}`; +} + /** * The Outfitting Page */ @@ -65,10 +75,11 @@ export default class OutfittingPage extends Page { } let fuelCapacity = ship.fuelCapacity; + this._getTitle = getTitle.bind(this, data.properties.name); return { error: null, - title: 'Outfitting - ' + data.properties.name, + title: this._getTitle(buildName), costTab: Persist.getCostTab() || 'costs', buildName, newBuildName: buildName, @@ -117,7 +128,7 @@ export default class OutfittingPage extends Page { this._updateRoute(shipId, newBuildName, code); } - this.setState({ buildName: newBuildName, code, savedCode: code }); + this.setState({ buildName: newBuildName, code, savedCode: code, title: this._getTitle(newBuildName) }); } /**