You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by he...@apache.org on 2015/10/23 19:37:57 UTC
[31/45] 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/29e7badf
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/29e7badf
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/29e7badf
Branch: refs/heads/hs/7919
Commit: 29e7badf057b2622e2fdbd3da648412e4a53ab02
Parents: e1f41c4
Author: Dave Brondsema <da...@brondsema.net>
Authored: Mon Oct 12 14:58:14 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Fri Oct 23 13:10:03 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/29e7badf/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 (
<div className={ 'draggable-element ' + subMenuClass } key={ 'draggable-' + _.uniqueId() }>
<div className='draggable-handle' key={ 'handleId-' + _.uniqueId() }>
- <NavBarItem {..._this.props} data={ item } name={ item.mount_point } url={ item.url } data-id={ i }/>
+ <NavBarItem data={ item } name={ item.mount_point } url={ item.url } data-id={ i }/>
</div>
</div>
);
@@ -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 <ToolSubMenu {...this.props} tools={ this.props.data.children } key={ `submenu-${_.uniqueId()}` } isSubmenu={ true }/>;
+ return <ToolSubMenu {...this.props} tools={ this.props.children } key={ `submenu-${_.uniqueId()}` } isSubmenu={ true }/>;
},
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 (
<div className={ classes }>
{ 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({