Return-Path: X-Original-To: apmail-allura-commits-archive@www.apache.org Delivered-To: apmail-allura-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0909B18065 for ; Fri, 16 Oct 2015 17:06:59 +0000 (UTC) Received: (qmail 74394 invoked by uid 500); 16 Oct 2015 17:06:59 -0000 Delivered-To: apmail-allura-commits-archive@allura.apache.org Received: (qmail 74358 invoked by uid 500); 16 Oct 2015 17:06:59 -0000 Mailing-List: contact commits-help@allura.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@allura.apache.org Delivered-To: mailing list commits@allura.apache.org Received: (qmail 73947 invoked by uid 99); 16 Oct 2015 17:06:58 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Oct 2015 17:06:58 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 98A5AE0BBE; Fri, 16 Oct 2015 17:06:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: brondsem@apache.org To: commits@allura.apache.org Date: Fri, 16 Oct 2015 17:07:32 -0000 Message-Id: <8cf5e5042c564dba9be338cb79f1b46d@git.apache.org> In-Reply-To: <4fbeed1eb4f04c27b59aa14de4d20491@git.apache.org> References: <4fbeed1eb4f04c27b59aa14de4d20491@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [36/46] allura git commit: [#7919] separate mount point vs name (aka label). Fix warnings [#7919] separate mount point vs name (aka label). Fix warnings Project: http://git-wip-us.apache.org/repos/asf/allura/repo Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/147f0592 Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/147f0592 Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/147f0592 Branch: refs/heads/db/7919 Commit: 147f05920a880e6ba39fced17fa56aff9b5d7f55 Parents: 38a245a Author: Dave Brondsema Authored: Mon Oct 12 14:58:14 2015 -0400 Committer: Heith Seewald Committed: Thu Oct 15 15:00:19 2015 -0400 ---------------------------------------------------------------------- Allura/allura/public/nf/js/navbar.es6.js | 56 ++++++++++++++------------- 1 file changed, 29 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/allura/blob/147f0592/Allura/allura/public/nf/js/navbar.es6.js ---------------------------------------------------------------------- diff --git a/Allura/allura/public/nf/js/navbar.es6.js b/Allura/allura/public/nf/js/navbar.es6.js index 7d64b08..a5ece5b 100644 --- a/Allura/allura/public/nf/js/navbar.es6.js +++ b/Allura/allura/public/nf/js/navbar.es6.js @@ -10,7 +10,7 @@ function _getProjectUrl(rest = true) { var [nbhd, proj] = window.location.pathname.split('/').slice(1, 3); var base = `${window.location.protocol}//${window.location.host}`; - return rest ? `${base}/rest/${nbhd}/${proj}/` : `${base}/${nbhd}/${proj}/`; + return rest ? `${base}/rest/${nbhd}/${proj}` : `${base}/${nbhd}/${proj}`; } /** @@ -19,26 +19,28 @@ function _getProjectUrl(rest = true) { * @param {NavBarItem} node - Return a "rest" version of the url. * @returns {string} */ -function getLabel(node) { - return node.props.children.props.children.props.name; +function getMountPoint(node) { + return node.props.children.props.children.props.mount_point; } -var ToolsPropType = { - name: React.PropTypes.string.isRequired, - url: React.PropTypes.string.isRequired, - isSubmenu: React.PropTypes.bool, - tools: React.PropTypes.arrayOf( - React.PropTypes.shape({ - ordinal: React.PropTypes.number, - mount_point: React.PropTypes.string, - name: React.PropTypes.string, - url: React.PropTypes.string, - is_anchored: React.PropTypes.bool, - tool_name: React.PropTypes.string, - icon: React.PropTypes.string - }) - ).isRequired -}; +function ToolsPropType() { + return { + name: React.PropTypes.string.isRequired, + url: React.PropTypes.string.isRequired, + isSubmenu: React.PropTypes.bool, + tools: React.PropTypes.arrayOf( + React.PropTypes.shape({ + ordinal: React.PropTypes.number, + mount_point: React.PropTypes.string, + name: React.PropTypes.string, + url: React.PropTypes.string, + is_anchored: React.PropTypes.bool, + tool_name: React.PropTypes.string, + icon: React.PropTypes.string + }) + ).isRequired + }; +} /** * A NavBar link, the most basic component of the NavBar. @@ -80,7 +82,7 @@ var ToolSubMenu = React.createClass({ return (
- +
); @@ -106,6 +108,7 @@ var NavBarItem = React.createClass({ name: React.PropTypes.string.isRequired, url: React.PropTypes.string.isRequired, isSubmenu: React.PropTypes.bool, + children: React.PropTypes.array.isRequired, tools: ToolsPropType }, generateLink: function () { @@ -113,12 +116,12 @@ var NavBarItem = React.createClass({ }, generateSubmenu: function () { - return ; + return ; }, generateContent: function () { var content = [this.generateLink()]; - if (this.props.data.children) { + if (this.props.children) { content.push(this.generateSubmenu()); } @@ -130,6 +133,7 @@ var NavBarItem = React.createClass({ var classes = this.props.editMode ? 'tb-item tb-item-edit' : 'tb-item'; classes = this.props.is_anchored ? `${classes} anchored` : classes; + return (
{ content } @@ -223,8 +227,6 @@ var NormalNavBar = React.createClass({ */ var AdminNav = React.createClass({ propTypes: { - name: React.PropTypes.string.isRequired, - url: React.PropTypes.string.isRequired, isSubmenu: React.PropTypes.bool, tools: ToolsPropType }, @@ -609,12 +611,12 @@ var Main = React.createClass({ }; data.map(function (tool, i) { - var name = getLabel(tool); + var mount_point = getMountPoint(tool); var index = tools.children.findIndex( - x => x.mount_point === name + x => x.mount_point === mount_point ); tools.children[index].ordinal = i; - params[i] = name; + params[i] = mount_point; }); this.setState({