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/12 19:59:46 UTC
[1/8] allura git commit: [#7920] Format navbar to pass eslint
inspection
Repository: allura
Updated Branches:
refs/heads/hs/7919 570a46a18 -> 57b224a67
[#7920] Format navbar to pass eslint inspection
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/911d4552
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/911d4552
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/911d4552
Branch: refs/heads/hs/7919
Commit: 911d455278e1d037d9100777ed4c2882e0290d57
Parents: 570a46a
Author: Heith Seewald <hs...@hsmb.local>
Authored: Tue Oct 6 12:10:25 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Tue Oct 6 12:10:25 2015 -0400
----------------------------------------------------------------------
Allura/allura/public/nf/js/navbar.es6.js | 673 +++++++++++++-------------
1 file changed, 340 insertions(+), 333 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/911d4552/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 eac0e91..9cdb907 100644
--- a/Allura/allura/public/nf/js/navbar.es6.js
+++ b/Allura/allura/public/nf/js/navbar.es6.js
@@ -8,9 +8,9 @@
* @returns {string}
*/
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}`;
+ 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}`;
}
/**
@@ -20,24 +20,24 @@ function _getProjectUrl(rest = true) {
* @returns {string}
*/
function getLabel(node) {
- return node.props.children.props.children.props.name;
+ return node.props.children.props.children.props.name;
}
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
+ 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
};
/**
@@ -45,20 +45,20 @@ var ToolsPropType = {
* @constructor
*/
var NavLink = React.createClass({
- propTypes: {
- name: React.PropTypes.string.isRequired,
- url: React.PropTypes.string.isRequired,
- style: React.PropTypes.object
- },
- render: function() {
- var classes = this.props.subMenu ? ' subMenu' : '';
- classes += this.props.classes;
- return (
- <a href={ this.props.url } key={ `link-${_.uniqueId()}` } className={ classes } style={ this.props.style }>
- { this.props.name }
- </a>
- );
- }
+ propTypes: {
+ name: React.PropTypes.string.isRequired,
+ url: React.PropTypes.string.isRequired,
+ style: React.PropTypes.object
+ },
+ render: function () {
+ var classes = this.props.subMenu ? ' subMenu' : '';
+ classes += this.props.classes;
+ return (
+ <a href={ this.props.url } key={ `link-${_.uniqueId()}` } className={ classes } style={ this.props.style }>
+ { this.props.name }
+ </a> // jshint ignore:line
+ );
+ }
});
/**
@@ -67,33 +67,34 @@ var NavLink = React.createClass({
* @constructor
*/
var ToolSubMenu = React.createClass({
- propTypes: {
- isSubmenu: React.PropTypes.bool,
- tools: ToolsPropType
- },
- handle: '.draggable-handle',
- mode: 'list',
- render: function() {
- var _this = this;
- var subMenuClass = this.props.isSubmenu ? ' submenu ' : '';
- var tools = this.props.tools.map(function(item, i) {
- 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 } />
- </div>
- </div>
+ propTypes: {
+ isSubmenu: React.PropTypes.bool,
+ tools: ToolsPropType
+ },
+ handle: '.draggable-handle',
+ mode: 'list',
+ render: function () {
+ var _this = this;
+ var subMenuClass = this.props.isSubmenu ? ' submenu ' : '';
+ var tools = this.props.tools.map(function (item, i) {
+ 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 }/>
+ </div>
+ </div>
+ );
+ });
+
+ return (
+ <div className='hidden' style={ { display: 'none'} }>
+ <ReactReorderable handle='.draggable-handle' mode='grid' onDragStart={ this.onDragStart } onDrop={ this.props.onToolReorder }
+ onChange={ this.onChange }>
+ { tools }
+ </ReactReorderable>
+ </div>
);
- });
-
- return (
- <div className='hidden' style={ { display: 'none'} }>
- <ReactReorderable handle='.draggable-handle' mode='grid' onDragStart={ this.onDragStart } onDrop={ this.props.onToolReorder } onChange={ this.onChange }>
- { tools }
- </ReactReorderable>
- </div>
- );
- }
+ }
});
/**
@@ -101,40 +102,40 @@ var ToolSubMenu = React.createClass({
* @constructor
*/
var NavBarItem = React.createClass({
- propTypes: {
- name: React.PropTypes.string.isRequired,
- url: React.PropTypes.string.isRequired,
- isSubmenu: React.PropTypes.bool,
- tools: ToolsPropType
- },
- generateLink: function() {
- return <NavLink url={ this.props.url } name={ this.props.name } key={ _.uniqueId() } />;
- },
-
- generateSubmenu: function() {
- return <ToolSubMenu {...this.props} tools={ this.props.data.children } key={ `submenu-${_.uniqueId()}` } isSubmenu={ true } />;
- },
-
- generateContent: function() {
- var content = [this.generateLink()];
- if (this.props.data.children) {
- content.push(this.generateSubmenu());
- }
+ propTypes: {
+ name: React.PropTypes.string.isRequired,
+ url: React.PropTypes.string.isRequired,
+ isSubmenu: React.PropTypes.bool,
+ tools: ToolsPropType
+ },
+ generateLink: function () {
+ return <NavLink url={ this.props.url } name={ this.props.name } key={ _.uniqueId() }/>;
+ },
+
+ generateSubmenu: function () {
+ return <ToolSubMenu {...this.props} tools={ this.props.data.children } key={ `submenu-${_.uniqueId()}` } isSubmenu={ true }/>;
+ },
+
+ generateContent: function () {
+ var content = [this.generateLink()];
+ if (this.props.data.children) {
+ content.push(this.generateSubmenu());
+ }
+
+ return content;
+ },
+
+ render: function () {
+ var content = this.generateContent();
+ var classes = this.props.editMode ? 'tb-item tb-item-edit' : 'tb-item';
+ classes = this.props.is_anchored ? `${classes} anchored` : classes;
- return content;
- },
-
- render: function() {
- var content = this.generateContent();
- 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 }
- </div>
- );
- }
+ return (
+ <div className={ classes }>
+ { content }
+ </div>
+ );
+ }
});
/**
@@ -142,27 +143,27 @@ var NavBarItem = React.createClass({
* @constructor
*/
var GroupingThreshold = React.createClass({
- propTypes: {
- initialValue: React.PropTypes.number.isRequired
- },
- getInitialState: function() {
- return {
- value: this.props.initialValue
- };
- },
-
- handleChange: function(event) {
- this.setState({
- value: event.target.value
- });
- this.props.onUpdateThreshold(event);
- },
-
- render: function() {
- return (
- <div>
- { !!this.props.isHidden &&
- <div id='threshold-config'>
+ propTypes: {
+ initialValue: React.PropTypes.number.isRequired
+ },
+ getInitialState: function () {
+ return {
+ value: this.props.initialValue
+ };
+ },
+
+ handleChange: function (event) {
+ this.setState({
+ value: event.target.value
+ });
+ this.props.onUpdateThreshold(event);
+ },
+
+ render: function () {
+ return (
+ <div>
+ { !!this.props.isHidden &&
+ <div id='threshold-config'>
<span>
<label htmlFor='threshold-input'>Grouping Threshold</label>
<input type='number' name='threshold-input' className='tooltip'
@@ -171,48 +172,49 @@ var GroupingThreshold = React.createClass({
onChange={ this.handleChange }
min='1' max='10'/>
</span>
- </div> }
- </div>
- );
- }
+ </div> }
+ </div>
+ );
+ }
});
+
/**
* The NavBar when in "Normal" mode.
* @constructor
*/
var NormalNavBar = React.createClass({
- buildMenu: function(item) {
- var classes = ` ui-icon-${item.icon}-32`;
- classes = item.is_anchored ? `${classes} anchored` : classes;
+ buildMenu: function (item) {
+ var classes = ` ui-icon-${item.icon}-32`;
+ classes = item.is_anchored ? `${classes} anchored` : classes;
- var subMenu;
- if (item.children) {
- subMenu = item.children.map(this.buildMenu);
- }
+ var subMenu;
+ if (item.children) {
+ subMenu = item.children.map(this.buildMenu);
+ }
+
+ return (
+ <li>
+ <a href={ item.url } key={ 'link-' + _.uniqueId() } className={ classes }>
+ { item.name }
+ </a>
+ <ul className={ item.children ? 'submenu' : '' }>
+ { subMenu }
+ </ul>
+ </li>
+ );
+ },
- return (
- <li>
- <a href={ item.url } key={ 'link-' + _.uniqueId() } className={ classes }>
- { item.name }
- </a>
- <ul className={ item.children ? 'submenu' : '' }>
- { subMenu }
- </ul>
- </li>
- );
- },
-
- render: function() {
- var listItems = this.props.items.map(this.buildMenu);
- var classes = 'dropdown';
- classes = this.props.isSubmenu ? classes += ' submenu' : classes;
- return (
- <ul className={ classes } key={ `toolList-${_.uniqueId()}` }>
- { listItems }
- </ul>
- );
- }
+ render: function () {
+ var listItems = this.props.items.map(this.buildMenu);
+ var classes = 'dropdown';
+ classes = this.props.isSubmenu ? classes += ' submenu' : classes;
+ return (
+ <ul className={ classes } key={ `toolList-${_.uniqueId()}` }>
+ { listItems }
+ </ul>
+ );
+ }
});
/**
@@ -220,54 +222,56 @@ var NormalNavBar = React.createClass({
* @constructor
*/
var AdminNav = React.createClass({
- propTypes: {
- name: React.PropTypes.string.isRequired,
- url: React.PropTypes.string.isRequired,
- isSubmenu: React.PropTypes.bool,
- tools: ToolsPropType
- },
- handle: '.draggable-handle',
- mode: 'grid',
- getInitialState: function() {
- return {
- hover: false
- };
- },
-
- mouseOver: function() {
- this.setState({
- hover: true
- });
- },
-
- mouseOut: function() {
- this.setState({
- hover: false
- });
- },
-
- render: function() {
- var _this = this;
- var subMenuClass = this.props.isSubmenu ? ' submenu ' : '';
- var tools = this.props.tools.map(function(item, i) {
- return (
- <div className={ 'draggable-element' + subMenuClass } key={ 'draggable-' + _.uniqueId() }>
- <div className='draggable-handle' key={ 'handleId-' + _.uniqueId() }>
- <NavBarItem onMouseOver={ _this.mouseOver } onMouseOut={ _this.mouseOut } {..._this.props} data={ item } name={ item.mount_point } url={ item.url }
- key={ 'tb-item-' + _.uniqueId() } is_anchored={ item.is_anchored } data-id={ i } />
- </div>
- </div>
+ propTypes: {
+ name: React.PropTypes.string.isRequired,
+ url: React.PropTypes.string.isRequired,
+ isSubmenu: React.PropTypes.bool,
+ tools: ToolsPropType
+ },
+ handle: '.draggable-handle',
+ mode: 'grid',
+ getInitialState: function () {
+ return {
+ hover: false
+ };
+ },
+
+ mouseOver: function () {
+ this.setState({
+ hover: true
+ });
+ },
+
+ mouseOut: function () {
+ this.setState({
+ hover: false
+ });
+ },
+
+ render: function () {
+ var _this = this;
+ var subMenuClass = this.props.isSubmenu ? ' submenu ' : '';
+ var tools = this.props.tools.map(function (item, i) {
+ return (
+ <div className={ 'draggable-element' + subMenuClass } key={ 'draggable-' + _.uniqueId() }>
+ <div className='draggable-handle' key={ 'handleId-' + _.uniqueId() }>
+ <NavBarItem onMouseOver={ _this.mouseOver } onMouseOut={ _this.mouseOut } {..._this.props} data={ item }
+ name={ item.mount_point } url={ item.url }
+ key={ 'tb-item-' + _.uniqueId() } is_anchored={ item.is_anchored } data-id={ i }/>
+ </div>
+ </div>
+ );
+ });
+
+ return (
+ <div className='react-drag edit-mode'>
+ <ReactReorderable key={ 'reorder-' + _.uniqueId() } handle='.draggable-handle' mode='grid' onDragStart={ this.onDragStart }
+ onDrop={ this.props.onToolReorder } onChange={ this.onChange }>
+ { tools }
+ </ReactReorderable>
+ </div>
);
- });
-
- return (
- <div className='react-drag edit-mode'>
- <ReactReorderable key={ 'reorder-' + _.uniqueId() } handle='.draggable-handle' mode='grid' onDragStart={ this.onDragStart } onDrop={ this.props.onToolReorder } onChange={ this.onChange }>
- { tools }
- </ReactReorderable>
- </div>
- );
- }
+ }
});
/**
@@ -275,17 +279,17 @@ var AdminNav = React.createClass({
* @constructor
*/
var ToggleAdminButton = React.createClass({
- propTypes: {
- visible: React.PropTypes.bool
- },
- render: function() {
- var classes = this.props.visible ? 'fa fa-unlock' : 'fa fa-lock';
- return (
- <button id='toggle-admin-btn' onClick={ this.props.handleButtonPush } className='admin-toolbar-right'>
- <i className={ classes }></i>
- </button>
- );
- }
+ propTypes: {
+ visible: React.PropTypes.bool
+ },
+ render: function () {
+ var classes = this.props.visible ? 'fa fa-unlock' : 'fa fa-lock';
+ return (
+ <button id='toggle-admin-btn' onClick={ this.props.handleButtonPush } className='admin-toolbar-right'>
+ <i className={ classes }></i>
+ </button>
+ );
+ }
});
/**
@@ -294,138 +298,141 @@ var ToggleAdminButton = React.createClass({
* @param {object} initialData - Consumes the _nav.json endpoint.
*/
var Main = React.createClass({
- propTypes: {
- initialData: ToolsPropType
- },
- getInitialState: function() {
- return {
- data: this.props.initialData,
- visible: false,
- _session_id: $.cookie('_session_id')
- };
- },
-
- /**
- * When invoked, this updates the state with the latest data from the server.
- */
- getNavJson: function() {
- $.get(`${_getProjectUrl(false)}/_nav.json`, function(result) {
- if (this.isMounted()) {
+ propTypes: {
+ initialData: ToolsPropType
+ },
+ getInitialState: function () {
+ return {
+ data: this.props.initialData,
+ visible: false,
+ _session_id: $.cookie('_session_id')
+ };
+ },
+
+ /**
+ * When invoked, this updates the state with the latest data from the server.
+ */
+ getNavJson: function () {
+ $.get(`${_getProjectUrl(false)}/_nav.json`, function (result) {
+ if (this.isMounted()) {
+ this.setState({
+ data: result
+ });
+ }
+ }.bind(this));
+ },
+
+ /**
+ * Handles the locking and unlocking of the NavBar
+ */
+ handleToggleAdmin: function () {
+ this.setState({
+ visible: !this.state.visible
+ });
+ },
+
+ /**
+ * Handles the changing of the NavBars grouping threshold.
+ * @param {object} event
+ */
+ onUpdateThreshold: function (event) {
+ var _this = this;
+ var thres = event.target.value;
+ var url = `${_getProjectUrl()}/admin/configure_tool_grouping`;
+ var csrf = $.cookie('_session_id');
+ var data = {
+ _session_id: csrf,
+ grouping_threshold: thres
+ };
+ var _data = this.state.data;
+ _data.grouping_threshold = thres;
this.setState({
- data: result
+ data: _data
});
- }
- }.bind(this));
- },
-
- /**
- * Handles the locking and unlocking of the NavBar
- */
- handleToggleAdmin: function() {
- this.setState({
- visible: !this.state.visible
- });
- },
-
- /**
- * Handles the changing of the NavBars grouping threshold.
- * @param {object} event
- */
- onUpdateThreshold: function(event) {
- var _this = this;
- var thres = event.target.value;
- var url = `${_getProjectUrl()}/admin/configure_tool_grouping`;
- var csrf = $.cookie('_session_id');
- var data = {
- _session_id: csrf,
- grouping_threshold: thres
- };
- var _data = this.state.data;
- _data.grouping_threshold = thres;
- this.setState({
- data: _data
- });
- this.setState({
- in_progress: true
- });
- $.post(url, data, function(resp) {}.bind(this)).always(function() {
- _this.setState({
- in_progress: false
- });
- });
-
- _this.getNavJson();
- return false;
- },
-
- /**
- * Handles the changing of the NavBars grouping threshold.
- * @param {array} data - Array of tools
- */
- onToolReorder: function(data) {
- var tools = this.state.data;
- var params = {
- _session_id: $.cookie('_session_id')
- };
-
- data.map(function(tool, i) {
- var name = getLabel(tool);
- var index = tools.children.findIndex(
- x => x.mount_point === name
- );
- tools.children[index].ordinal = i;
- params[i] = name;
- });
-
- this.setState({
- data: tools
- });
- var _this = this;
- var url = _getProjectUrl() + '/admin/mount_order';
- $.ajax({
- type: 'POST',
- url: url,
- data: params,
- success: function() {
- $('#messages').notify('Tool order updated',
- {
- status: 'confirm'
- });
+ this.setState({
+ in_progress: true
+ });
+ $.post(url, data, function () {
+ }.bind(this)).always(function () {
+ _this.setState({
+ in_progress: false
+ });
+ });
+
_this.getNavJson();
- },
-
- error: function() {
- $('#messages').notify('Error saving tool order.',
- {
- status: 'error'
- });
- }
- });
- },
-
- render: function() {
- var editMode = this.state.visible ? 'edit-mode' : '';
- var _this = this;
- var navBarSwitch = (showAdmin) => {
- if (showAdmin) {
+ return false;
+ },
+
+ /**
+ * Handles the changing of the NavBars grouping threshold.
+ * @param {array} data - Array of tools
+ */
+ onToolReorder: function (data) {
+ var tools = this.state.data;
+ var params = {
+ _session_id: $.cookie('_session_id')
+ };
+
+ data.map(function (tool, i) {
+ var name = getLabel(tool);
+ var index = tools.children.findIndex(
+ x => x.mount_point === name
+ );
+ tools.children[index].ordinal = i;
+ params[i] = name;
+ });
+
+ this.setState({
+ data: tools
+ });
+ var _this = this;
+ var url = _getProjectUrl() + '/admin/mount_order';
+ $.ajax({
+ type: 'POST',
+ url: url,
+ data: params,
+ success: function () {
+ $('#messages').notify('Tool order updated',
+ {
+ status: 'confirm'
+ });
+ _this.getNavJson();
+ },
+
+ error: function () {
+ $('#messages').notify('Error saving tool order.',
+ {
+ status: 'error'
+ });
+ }
+ });
+ },
+
+ render: function () {
+ var editMode = this.state.visible ? 'edit-mode' : '';
+ var _this = this;
+ var navBarSwitch = (showAdmin) => {
+ if (showAdmin) {
+ return (
+ <AdminNav tools={ _this.state.data.children } data={ _this.state.data } onToolReorder={ _this.onToolReorder }
+ onUpdateMountOrder={ _this.onUpdateMountOrder } editMode={ _this.state.visible }
+ />
+ );
+ } else {
+ return <NormalNavBar items={ _this.state.data.children } key={ `normalNav-${_.uniqueId()}` }/>;
+ }
+ };
+ var navBar = navBarSwitch(this.state.visible);
+
return (
- <AdminNav tools={ _this.state.data.children } data={ _this.state.data } onToolReorder={ _this.onToolReorder } onUpdateMountOrder={ _this.onUpdateMountOrder } editMode={ _this.state.visible }
- />
- );
- } else {
- return <NormalNavBar items={ _this.state.data.children } key={ `normalNav-${_.uniqueId()}` } />;
- }
- };
- var navBar = navBarSwitch(this.state.visible);
-
- return (
- <div ref={ _.uniqueId() } className={ 'nav_admin ' + editMode }>
- { navBar }
- <div id='bar-config'>
- <GroupingThreshold onUpdateThreshold={ this.onUpdateThreshold } isHidden={ this.state.visible } initialValue={ this.state.data.grouping_threshold } />
- </div>
- <ToggleAdminButton key={ _.uniqueId() } handleButtonPush={ this.handleToggleAdmin } visible={ this.state.visible } />
- </div>
- );
- }
+ <div ref={ _.uniqueId() } className={ 'nav_admin ' + editMode }>
+ { navBar }
+ <div id='bar-config'>
+ <GroupingThreshold onUpdateThreshold={ this.onUpdateThreshold } isHidden={ this.state.visible }
+ initialValue={ this.state.data.grouping_threshold }/>
+ </div>
+ <ToggleAdminButton key={ _.uniqueId() } handleButtonPush={ this.handleToggleAdmin } visible={ this.state.visible }/>
+ </div>
+ );
+ }
});
[7/8] allura git commit: [#7919] Add styles for the "add new tool"
menu
Posted by he...@apache.org.
[#7919] Add styles for the "add new tool" menu
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/171110b9
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/171110b9
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/171110b9
Branch: refs/heads/hs/7919
Commit: 171110b918cf352ee1bc91f7840c3cca14e3a5f0
Parents: 039b973
Author: Heith Seewald <hs...@hsmb.local>
Authored: Mon Oct 12 13:45:43 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Mon Oct 12 13:46:47 2015 -0400
----------------------------------------------------------------------
Allura/allura/public/nf/css/navbar.css | 524 +++++++++++++++++++---------
1 file changed, 367 insertions(+), 157 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/171110b9/Allura/allura/public/nf/css/navbar.css
----------------------------------------------------------------------
diff --git a/Allura/allura/public/nf/css/navbar.css b/Allura/allura/public/nf/css/navbar.css
index 7ddbdac..a5d24bc 100644
--- a/Allura/allura/public/nf/css/navbar.css
+++ b/Allura/allura/public/nf/css/navbar.css
@@ -1,228 +1,438 @@
.submenu ul {
- list-style: none;
- width: 350px;
- display: none;
+ list-style: none;
+ width: 350px;
+ display: none;
}
+
.hidden {
- display: none;
+ display: none;
}
+
.submenu ul {
- list-style: none;
- display: block;
- position: relative;
- background-color: rgb(237, 237, 237);
- border: solid darkgray 1px;
- border-radius: 0 0 5px 5px;
- margin-top: -13px;
- margin-left: 341px;
- left: -25px;
- padding-left: 0;
- box-shadow: 3px 0 3px #d7d7d7;
- z-index: -1000;
- padding-top: 11px;
+ list-style: none;
+ display: block;
+ position: relative;
+ background-color: rgb(237, 237, 237);
+ border: solid darkgray 1px;
+ border-radius: 0 0 5px 5px;
+ margin-top: -13px;
+ margin-left: 341px;
+ left: -25px;
+ padding-left: 0;
+ box-shadow: 3px 0 3px #d7d7d7;
+ z-index: -1000;
+ padding-top: 11px;
}
+
#bar-config {
- display: inline-flex;
- position: absolute;
- right: 0;
- top: -30px;
- align-items: stretch;
- flex: 1 1 auto;
+ display: inline-flex;
+ position: absolute;
+ right: 0;
+ top: -30px;
+ align-items: stretch;
+ flex: 1 1 auto;
}
+
#threshold-config > span > input {
- width: 2rem;
- background-color: #A1A1A1;
- color: white;
- font-weight: bold;
+ width: 2rem;
+ background-color: #A1A1A1;
+ color: white;
+ font-weight: bold;
}
+
#toggle-admin-btn {
- position: absolute;
- right: -9px;
- top: 0;
- width: 2rem;
- height: 1.8rem;
+ position: absolute;
+ right: -9px;
+ top: 0;
+ width: 2rem;
+ height: 1.8rem;
}
+
nav {
- display: flex;
- flex-direction: row;
- justify-content: center;
- margin: auto;
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+ margin: auto;
}
+
.nav_admin ul {
- display: flex;
+ display: flex;
}
+
#top_nav_admin > div.edit-mode > ul {
- display: flex;
- flex-direction: row;
- flex-wrap: wrap;
- flex: 1;
+ display: flex;
+ flex-direction: row;
+ flex-wrap: wrap;
+ flex: 1;
}
+
#top_nav_admin > div.edit-mode > ul > .tb-item {
- background-color: #F0F0F0;
- margin-top: 0.5rem;
- display: inline-grid;
- margin-left: .5rem;
- border: 1px dashed gray;
- padding: 0.3rem 0.6rem 0.3rem 0.6rem;
+ background-color: #F0F0F0;
+ margin-top: 0.5rem;
+ display: inline-grid;
+ margin-left: .5rem;
+ border: 1px dashed gray;
+ padding: 0.3rem 0.6rem 0.3rem 0.6rem;
}
+
.admin-toolbar {
- display: flex;
+ display: flex;
}
+
#top_nav_admin {
- display: grid;
- flex-direction: row;
- flex-wrap: wrap;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- -o-border-radius: 4px;
- -ms-border-radius: 4px;
- -khtml-border-radius: 4px;
- border-radius: 4px;
- width: 940px;
+ display: grid;
+ flex-direction: row;
+ flex-wrap: wrap;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -o-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ width: 940px;
}
+
.btn-bar {
- display: block;
- clear: both;
- padding: 0 10px 0 10px;
- -moz-border-radius: 4px;
- -webkit-border-radius: 4px;
- -o-border-radius: 4px;
- -ms-border-radius: 4px;
- -khtml-border-radius: 4px;
- border-radius: 4px;
- text-decoration: none;
- min-width: 1em;
- text-align: center;
- position: relative;
- margin: 0 0 20px;
+ display: block;
+ clear: both;
+ padding: 0 10px 0 10px;
+ -moz-border-radius: 4px;
+ -webkit-border-radius: 4px;
+ -o-border-radius: 4px;
+ -ms-border-radius: 4px;
+ -khtml-border-radius: 4px;
+ border-radius: 4px;
+ text-decoration: none;
+ min-width: 1em;
+ text-align: center;
+ position: relative;
+ margin: 0 0 20px;
}
+
ul.dropdown li {
- float: left;
- vertical-align: middle;
- zoom: 1;
- padding-top: 10px;
- padding-bottom: 10px;
+ float: left;
+ vertical-align: middle;
+ zoom: 1;
+ padding-top: 10px;
+ padding-bottom: 10px;
}
+
ul.dropdown, ul.dropdown li, ul.dropdown ul {
- list-style: none;
- margin: 0;
- padding: 0;
+ list-style: none;
+ margin: 0;
+ padding: 0;
}
+
li.tb-item-edit > input {
- width: 2.2rem;
+ width: 2.2rem;
}
+
li.tb-item-edit > label > i {
- padding-right: 0.7rem;
- color: grey;
- font-size: larger;
- cursor: move;
+ padding-right: 0.7rem;
+ color: grey;
+ font-size: larger;
+ cursor: move;
}
+
div.edit-mode > ul > div.anchored {
- background: grey;
+ background: grey;
}
+
div.anchored > li.tb-item-edit > label > i {
- padding-right: 0.7rem;
- color: #898c89;
- font-size: larger;
- cursor: not-allowed;
+ padding-right: 0.7rem;
+ color: #898c89;
+ font-size: larger;
+ cursor: not-allowed;
}
.react-reorderable-item-active, .draggable-element {
- height: 28px;
- width: 120px;
- margin-top: 5px;
+ height: 28px;
+ width: 120px;
+ margin-top: 5px;
}
+
.draggable-element {
- background-color: rgb(255, 255, 255);
- border: 1px dashed #B5AFAF;
- min-width: 100%;
- border-radius: 3px;
- width: 9rem;
- height: 30px;
+ background-color: rgb(255, 255, 255);
+ border: 1px dashed #B5AFAF;
+ min-width: 100%;
+ border-radius: 3px;
+ width: 9rem;
+ height: 30px;
}
+
.draggable-handle {
- background-color: rgb(126, 125, 125);
- width: 15%;
- height: 80%;
- border-radius: 4px 0 0 4px;
- margin-top: -2px;
- margin-left: -2px;
- z-index: 10000;
- cursor: move;
- color: white;
- padding: 3px 3px 4px;
- border: 1px solid #575656;
+ background-color: rgb(126, 125, 125);
+ width: 15%;
+ height: 80%;
+ border-radius: 4px 0 0 4px;
+ margin-top: -2px;
+ margin-left: -2px;
+ z-index: 10000;
+ cursor: move;
+ color: white;
+ padding: 3px 3px 4px;
+ border: 1px solid #575656;
}
+
ul.dropdown li {
- float: left;
- vertical-align: middle;
- zoom: 1;
- padding-top: 10px;
- padding-bottom: 10px;
+ float: left;
+ vertical-align: middle;
+ zoom: 1;
+ padding-top: 10px;
+ padding-bottom: 10px;
}
+
#content {
- width: 990px;
+ width: 990px;
}
+
.react-reorderable-item {
- display: inline-flex;
- margin-right: 2%;
- /* float: left; */
+ display: inline-flex;
+ margin-right: 2%;
+ /* float: left; */
}
+
.react-reorderable-item-active {
- border: 3px dashed #9e9e9e;
- background: #c9c9c9;
- width: 9rem;
+ border: 3px dashed #9e9e9e;
+ background: #c9c9c9;
+ width: 9rem;
}
+
.react-reorderable-item-active div {
- display: none;
+ display: none;
}
+
.react-reorderable-handle {
- position: absolute;
+ position: absolute;
}
+
.react-drag > div > div > div > div > div > a {
- margin-top: 2px;
- text-align: center;
- color: #898989;
- width: 5rem;
- /* margin-bottom: 10px; */
- min-width: 100%;
- overflow-x: hidden;
- overflow-wrap: break-word;
- height: 18px;
- position: relative;
+ margin-top: 2px;
+ text-align: center;
+ color: #898989;
+ width: 5rem;
+ /* margin-bottom: 10px; */
+ min-width: 100%;
+ overflow-x: hidden;
+ overflow-wrap: break-word;
+ height: 18px;
+ position: relative;
}
+
.react-drag > div > div > div > div > div {
- width: 100%;
- position: relative;
- right: -40px;
+ width: 100%;
+ position: relative;
+ right: -40px;
}
+
.react-drag {
- -webkit-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- -o-user-select: none;
- user-select: none;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ -o-user-select: none;
+ user-select: none;
}
+
ul.dropdown ul {
- visibility: hidden;
- position: absolute;
- top: 70px;
- z-index: 598;
- background-color: #ffffff;
- border: 1px solid #dddddd;
- border-top-width: 0;
+ visibility: hidden;
+ position: absolute;
+ top: 70px;
+ z-index: 598;
+ background-color: #ffffff;
+ border: 1px solid #dddddd;
+ border-top-width: 0;
}
+
ul.dropdown ul li a {
- float: none;
- display: block;
- text-align: left;
- margin-right: 0;
+ float: none;
+ display: block;
+ text-align: left;
+ margin-right: 0;
}
+
ul.dropdown .hover, ul.dropdown li:hover {
- position: relative;
- z-index: 599;
- cursor: default;
+ position: relative;
+ z-index: 599;
+ cursor: default;
}
+
.anchored {
- cursor: not-allowed;
+ cursor: not-allowed;
+}
+
+.tool-partition {
+ height: 0;
+ margin-top: 5px;
+ border-top: 3px solid #777;
+}
+
+.installable-tool-box {
+ list-style: none;
+ display: flex;
+ background-color: #FFFEFA;
+ flex-wrap: wrap;
+ justify-content: space-around;
}
+
+.installable-tool-box li {
+ margin-top: 15px;
+
+ height: auto;
+ border-radius: 4px;
+ padding: 10px;
+ text-align: center;
+ font-size: x-large;
+ list-style: none;
+ cursor: pointer;
+}
+
+.installable-tool-box li:hover {
+ background: #09C;
+ color: white;
+}
+
+.selected-tool {
+ background: white;
+ border: 1px solid #09C;
+}
+
+.installable-tool-box li.selected-tool:hover {
+ background: white;
+ color: rgb(85, 85, 85);
+}
+
+.tool-card {
+ width: 800px;
+ margin-left: 25px;
+ background-color: white;
+ display: block;
+ border: 1px solid #777;
+ border-radius: 2px 2px 5px 5px;
+ height: auto;
+ position: absolute;
+ overflow: auto;
+ right: 0;
+ min-height: 21rem;
+}
+
+.box-title {
+ width: 800px;
+ height: auto;
+ font-size: large;
+ text-align: center;
+ padding-bottom: 10px;
+ padding-top: 10px;
+ background: #606060;
+ color: white;
+}
+
+.tool-info {
+ min-height: 12rem;
+ padding: 35px 5px 5px 10px;
+ display: block;
+}
+
+.tool-info-left p {
+ text-align: center;
+ padding-bottom: 0;
+ vertical-align: text-top;
+ padding-top: 18px;
+ position: relative;
+ left: 0;
+ font-size: large;
+ font-weight: 400;
+ margin: 2rem 80px 100px 90px;
+ color: #CCCBC8;
+}
+
+.tool-info-left h1 {
+ text-align: center;
+ padding-bottom: 0;
+ vertical-align: text-top;
+ padding-top: 18px;
+ position: relative;
+ left: 0;
+ font-size: xx-large;
+ background-color: #E7E7E7;
+ color: #5B5B5B;
+ height: 3rem;
+}
+
+.add-tool-button {
+ width: auto;
+ height: auto;
+ background: white;
+ min-width: 6rem;
+ min-height: 2.6rem;
+ font-size: large;
+ clear: both;
+ position: relative;
+ right: -4.8rem;
+ bottom: 0.1rem;
+}
+
+.tool-info-left {
+ background: #727170;
+ width: 60%;
+ height: auto;
+ left: 0;
+ top: 0;
+ color: white;
+ position: absolute;
+}
+
+.tool-info-right {
+ background: rgba(239, 239, 239, .7);
+ width: 40%;
+ height: 100%;
+ right: 0;
+ display: block;
+ clear: both;
+ top: 0;
+ position: absolute;
+}
+
+.tool-form {
+ display: inline-block;
+ width: 100%;
+ position: absolute;
+ right: 0;
+ top: 0;
+ padding-top: 1rem;
+ height: auto;
+}
+
+#add-tool-form > label {
+ padding: 0;
+ font-size: 13pt;
+ position: absolute;
+ margin-left: 42px;
+}
+
+#add-tool-form > p {
+ font-size: large;
+
+}
+
+#add-tool-form > input {
+ padding-top: 10px;
+ padding-left: 10px;
+ width: 63%;
+ margin: 22px 62px 10px 40px;
+}
+
+#add-tool-form {
+ position: absolute;
+ left: auto;
+ padding-top: 20px;
+ padding-left: 25px;
+ display: block;
+ padding-right: 25px;
+}
+
+.tool-form-fields {
+ clear: both;
+ position: relative;
+ display: flex;
+ flex-direction: row;
+}
\ No newline at end of file
[3/8] allura git commit: [#7920] Fix routing conflict for tools api
endpoint
Posted by he...@apache.org.
[#7920] Fix routing conflict for tools api endpoint
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/52d27cba
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/52d27cba
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/52d27cba
Branch: refs/heads/hs/7919
Commit: 52d27cba5fc580e2fabe99b7071127b6c82ac8fb
Parents: cd8cc74
Author: Heith Seewald <hs...@hsmb.local>
Authored: Tue Oct 6 12:24:55 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Tue Oct 6 12:24:55 2015 -0400
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/52d27cba/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 459c851..53a3306 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -795,14 +795,13 @@ class ProjectAdminRestController(BaseController):
return {'status': 'ok'}
@expose('json:')
- def tools(self, **kw):
+ def installable_tools(self, **kw):
""" List of installable tools
-
"""
response.content_type = 'application/json'
- tools_names = [t['name'] for t in AdminApp.installable_tools_for(c.project)]
+ tools = [t['name'] for t in AdminApp.installable_tools_for(c.project)]
- return {'status': 'ok'}
+ return {'tools': tools}
@expose('json:')
@require_post()
[4/8] allura git commit: [#7919] Add additional fields to the rest api
Posted by he...@apache.org.
[#7919] Add additional fields to the rest api
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/95715d18
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/95715d18
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/95715d18
Branch: refs/heads/hs/7919
Commit: 95715d185a89ecf46aacddcde0c2260f0054bbc9
Parents: 52d27cb
Author: Heith Seewald <hs...@hsmb.local>
Authored: Wed Oct 7 14:38:40 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Wed Oct 7 14:38:40 2015 -0400
----------------------------------------------------------------------
Allura/allura/app.py | 24 +++++++++++++++++++++---
Allura/allura/ext/admin/admin_main.py | 13 ++++++++++++-
2 files changed, 33 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/95715d18/Allura/allura/app.py
----------------------------------------------------------------------
diff --git a/Allura/allura/app.py b/Allura/allura/app.py
index bd6f36b..cf0946d 100644
--- a/Allura/allura/app.py
+++ b/Allura/allura/app.py
@@ -190,6 +190,18 @@ class SitemapEntry(object):
return self.url in request.upath_info or any([
url in request.upath_info for url in self.matching_urls])
+ def __json__(self):
+ return dict(
+ label=self.label,
+ className=self.className,
+ url=self.url,
+ small=self.small,
+ ui_icon=self.ui_icon,
+ children=self.children,
+ tool_name=self.tool_name,
+ matching_urls=self.matching_urls,
+ extra_html_attrs=self.extra_html_attrs,
+ )
class Application(object):
@@ -754,9 +766,15 @@ class Application(object):
Returns dict that will be included in project's API under tools key.
"""
- return {'name': self.config.tool_name,
- 'mount_point': self.config.options.mount_point,
- 'label': self.config.options.mount_label}
+ return {
+ 'name': self.config.tool_name,
+ 'mount_point': self.config.options.mount_point,
+ 'url': self.config.url(),
+ 'icons': self.icons,
+ 'installable': self.installable,
+ 'tool_label': self.tool_label,
+ 'mount_label': self.config.options.mount_label
+ }
class AdminControllerMixin(object):
http://git-wip-us.apache.org/repos/asf/allura/blob/95715d18/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 53a3306..b633529 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -799,7 +799,18 @@ class ProjectAdminRestController(BaseController):
""" List of installable tools
"""
response.content_type = 'application/json'
- tools = [t['name'] for t in AdminApp.installable_tools_for(c.project)]
+ tools = []
+ for tool in AdminApp.installable_tools_for(c.project):
+ tools.append({
+ 'name': tool['name'],
+ 'description': " ".join(tool['app'].tool_description.split()),
+ 'icons': tool['app'].icons,
+ 'defaults': {
+ 'default_options': tool['app'].default_options(),
+ 'default_mount_label': tool['app'].default_mount_label,
+ 'default_mount_point': tool['app'].default_mount_point,
+ }
+ })
return {'tools': tools}
[2/8] allura git commit: [#7920] Fix import error
Posted by he...@apache.org.
[#7920] Fix import error
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/cd8cc744
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/cd8cc744
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/cd8cc744
Branch: refs/heads/hs/7919
Commit: cd8cc7449271b10fe34dba6cf397c2791d6f06e6
Parents: 911d455
Author: Heith Seewald <hs...@hsmb.local>
Authored: Tue Oct 6 12:19:14 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Tue Oct 6 12:19:14 2015 -0400
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/cd8cc744/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index 4360ace..459c851 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -21,7 +21,7 @@ from urlparse import urlparse
import json
from operator import itemgetter
import pkg_resources
-from pylons import tmpl_context as c, app_globals as g
+from pylons import tmpl_context as c, app_globals as g, response
from pylons import request
from paste.deploy.converters import asbool, aslist
from tg import expose, redirect, flash, validate, config, jsonify
[5/8] allura git commit: [#7919] Fix endpoint to show installable
tools for a given project
Posted by he...@apache.org.
[#7919] Fix endpoint to show installable tools for a given project
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/a6d2f2ef
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/a6d2f2ef
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/a6d2f2ef
Branch: refs/heads/hs/7919
Commit: a6d2f2ef1e7d71444a68721d196989ca02d400db
Parents: 95715d1
Author: Heith Seewald <hs...@hsmb.local>
Authored: Mon Oct 12 13:43:12 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Mon Oct 12 13:43:12 2015 -0400
----------------------------------------------------------------------
Allura/allura/ext/admin/admin_main.py | 32 ++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/a6d2f2ef/Allura/allura/ext/admin/admin_main.py
----------------------------------------------------------------------
diff --git a/Allura/allura/ext/admin/admin_main.py b/Allura/allura/ext/admin/admin_main.py
index b633529..a1602da 100644
--- a/Allura/allura/ext/admin/admin_main.py
+++ b/Allura/allura/ext/admin/admin_main.py
@@ -796,7 +796,7 @@ class ProjectAdminRestController(BaseController):
@expose('json:')
def installable_tools(self, **kw):
- """ List of installable tools
+ """ List of installable tools and their default options.
"""
response.content_type = 'application/json'
tools = []
@@ -808,7 +808,8 @@ class ProjectAdminRestController(BaseController):
'defaults': {
'default_options': tool['app'].default_options(),
'default_mount_label': tool['app'].default_mount_label,
- 'default_mount_point': tool['app'].default_mount_point,
+ 'default_mount_point': tool['app'].admin_menu_delete_button,
+ 'modal': tool['app'].admin_modal,
}
})
@@ -859,6 +860,32 @@ class ProjectAdminRestController(BaseController):
}
@expose('json:')
+ @require_post()
+ def mount_point(self, mount_point=None, **kw):
+ """
+ Returns a tool from a given mount point
+ """
+ response.content_type = 'application/json'
+
+ tool = c.project.app_instance(mount_point)
+
+ if tool is None:
+ return {
+ 'exists': False,
+ 'info': 'Mount point does not exists.',
+ }
+
+ try:
+ info = json.dumps(tool)
+ except TypeError:
+ info = "Could not serialize tool."
+
+ return {
+ 'exist': True,
+ 'info': info
+ }
+
+ @expose('json:')
def export_status(self, **kw):
"""
Check the status of a bulk export.
@@ -899,6 +926,7 @@ class ProjectAdminRestController(BaseController):
"""
controller = ProjectAdminController()
+ ordinal = 0
if not tool or not mount_point or not mount_label:
return {
[8/8] allura git commit: [#7919] Add "Add new tool" feature
Posted by he...@apache.org.
[#7919] Add "Add new tool" feature
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/57b224a6
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/57b224a6
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/57b224a6
Branch: refs/heads/hs/7919
Commit: 57b224a67f1650efa0e60db0dae66e2e1359ce0c
Parents: 171110b
Author: Heith Seewald <hs...@hsmb.local>
Authored: Mon Oct 12 13:59:23 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Mon Oct 12 13:59:23 2015 -0400
----------------------------------------------------------------------
Allura/allura/public/nf/js/navbar.es6.js | 250 +++++++++++++++++++++++++-
1 file changed, 248 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/57b224a6/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 9cdb907..5d62002 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}/`;
}
/**
@@ -292,6 +292,246 @@ var ToggleAdminButton = React.createClass({
}
});
+//////////////////
+// Add New Tool //
+//////////////////
+
+var NewToolButton = React.createClass({
+ render: function () {
+ return (
+ <button id='new-tool-btn' onClick={ this.props.handleAddButton } className=''>
+ <i className={ classes }></i>
+ </button>
+ );
+ }
+});
+
+
+/**
+ * Menu for adding a new tool.
+ * @constructor
+ */
+var NewToolMenu = React.createClass({
+ propTypes: {
+ tools: React.PropTypes.array,
+ onPushAddButton: React.PropTypes.func,
+ onSetActive: React.PropTypes.func,
+ formData: React.PropTypes.object,
+ visible: React.PropTypes.bool
+ },
+
+ render: function () {
+ var _this = this;
+
+ var tools = this.props.tools.map(function (tool, i) {
+ var classes;
+ if (_this.props.active && _this.props.active.name === tool.name) {
+ classes = " selected-tool"
+ }
+ else {
+ classes = ""
+ }
+ return (
+ <li className={classes}
+ id={"add-new-" + tool.name}
+ key={`new-tool-btn-${i}`}
+ onClick={_this.props.handleChangeTool}>
+ {tool.name}
+ </li>
+ )
+ });
+
+ return (
+ <div className="tool-card">
+ <div className="box-title">Add a new tool
+ </div>
+ <div id="installable-items">
+ <ul className="installable-tool-box">
+ {tools}
+ </ul>
+ </div>
+ <div className="tool-partition"></div>
+ <NewToolInfo {...this.props}
+ name={this.props.active.name}
+ description={this.props.active.description}
+ handleAddButton={this.props.handleAddButton}/>
+ </div>
+ );
+ }
+});
+
+var InstallNewToolForm = React.createClass({
+ render: function () {
+ console.log(this.props.active.name);
+ if (this.props.active.name === "Add a tool"){
+
+ return(<div></div>);
+ }
+ var default_mount_point = this.props.active.defaults.default_mount_point;
+ var default_mount_label = this.props.active.defaults.default_mount_label;
+
+ return (
+ <form id="add-tool-form">
+ <label htmlFor="mount_label">Label</label>
+ <input id="mount_label" onChange={this.props.handleChangeForm} value={default_mount_label} />
+
+ <label htmlFor="mount_point">Url Path</label>
+ <input id="mount_point"
+ onChange={this.props.handleChangeForm}
+ onBlur={this.props.validateMountPoint}
+ value={this.props.formData.mount_point}/>
+
+ <p style={{"color": "grey"}}><small>http://hs/p/finna/</small><strong style={{"color": "orange"}}>
+ {this.props.formData.mount_point}
+ </strong></p>
+
+ <button id="new-tool-submit"
+ onClick={this.props.handleAddButton}
+ className="add-tool-button">
+ Add Tool
+ </button>
+ </form>
+ );
+ }
+});
+
+
+var NewToolInfo = React.createClass({
+ propTypes: {
+ name: React.PropTypes.string,
+ description: React.PropTypes.description,
+ handleAddButton: React.PropTypes.func
+ },
+
+
+ render: function () {
+ return (
+ <div className="tool-info">
+ <div className="tool-info-left">
+ <h1>{this.props.name}</h1>
+ <p>{this.props.description}</p>
+ </div>
+ <div className="tool-info-right">
+ <InstallNewToolForm {...this.props} />
+ </div>
+ </div>
+ );
+ }
+});
+
+var NewToolMain = React.createClass({
+ getInitialState: function () {
+ let toolPlaceHolder = {
+ name: "Add a tool",
+ description: "click on one of the tools shown above to add it to your project."
+ };
+
+ return {
+ installableTools: [toolPlaceHolder],
+ active: toolPlaceHolder,
+ new_tool: {
+ mount_point: "",
+ mount_label: ""
+ }
+ };
+ },
+
+
+ componentDidMount: function () {
+ let _this = this;
+ $.get(_getProjectUrl(true) + "/admin/installable_tools/", function (result) {
+ if (this.isMounted()) {
+ console.log('hit is mounted', result['tools']);
+ this.setState({
+ installableTools: result['tools']
+ });
+ }
+ }.bind(this));
+ },
+ handleAddButton: function (e) {
+ e.preventDefault();
+ console.log('Add new too button pushed');
+ console.log('e.target.name', e);
+ console.log(e.target.textContent);
+
+ },
+ handleChangeTool: function (e) {
+ console.log(`Changed tool to: ${e.target.textContent}`);
+ this._setActiveByName(e.target.textContent);
+
+ },
+ _setActiveByName: function (name) {
+ var index = this.state.installableTools.findIndex(
+ x => x.name === name
+ );
+ this.setState({
+ active: this.state.installableTools[index]
+ });
+ },
+
+ handleChangeForm: function (e) {
+ console.log(e.target.value);
+ var _new_tool = this.state.new_tool;
+
+ console.log(e.target.id);
+ _new_tool[e.target.id] = e.target.value;
+
+ this.setState({
+ new_tool: _new_tool
+ });
+
+ },
+ handleSubmit: function (e) {
+ e.preventDefault();
+ var nextItems = this.state.items.concat([this.state.text]);
+ var nextText = '';
+ this.setState({items: nextItems, text: nextText});
+ },
+
+ validateMountPoint: function (e) {
+ e.preventDefault();
+ let url = _getProjectUrl(true) + '/admin/mount_point/';
+
+ let data = {
+ 'mount_point': e.target.value,
+ '_session_id': $.cookie('_session_id')
+ };
+
+ let d = $.post(url, data).done(function (result) {
+ console.log(result);
+ });
+
+ if(d.responseJSON.exists){
+ alert('exists');
+ }else{
+ alert('does not exist');
+ }
+
+ },
+
+ render: function () {
+ return <NewToolMenu
+ active={this.state.active}
+ tools={this.state.installableTools}
+ formData={this.state.new_tool}
+ handleChangeTool={this.handleChangeTool}
+ handleChangeForm={this.handleChangeForm}
+ validateMountPoint={this.validateMountPoint}
+ handleAddButton={this.handleAddButton}/>;
+ }
+});
+
+
+
+
+
+
+
+
+
+
+////////////////////////////////////////////
+
/**
* The main "controller view" of the NavBar.
* @constructor
@@ -299,7 +539,8 @@ var ToggleAdminButton = React.createClass({
*/
var Main = React.createClass({
propTypes: {
- initialData: ToolsPropType
+ initialData: ToolsPropType,
+ installableTools: React.PropTypes.array
},
getInitialState: function () {
return {
@@ -322,6 +563,7 @@ var Main = React.createClass({
}.bind(this));
},
+
/**
* Handles the locking and unlocking of the NavBar
*/
@@ -436,3 +678,7 @@ var Main = React.createClass({
);
}
});
+
+
+ React.render(React.createElement(NewToolMain, {
+ }), document.getElementById("add_tool_menu"));
\ No newline at end of file
[6/8] allura git commit: [#7919] Add div to attach the "Add new tool"
menu
Posted by he...@apache.org.
[#7919] Add div to attach the "Add new tool" menu
Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/039b9734
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/039b9734
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/039b9734
Branch: refs/heads/hs/7919
Commit: 039b9734a8c252d2b2a785a69b73f284270b31ff
Parents: a6d2f2e
Author: Heith Seewald <hs...@hsmb.local>
Authored: Mon Oct 12 13:44:49 2015 -0400
Committer: Heith Seewald <hs...@hsmb.local>
Committed: Mon Oct 12 13:44:49 2015 -0400
----------------------------------------------------------------------
Allura/allura/templates/jinja_master/master.html | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/allura/blob/039b9734/Allura/allura/templates/jinja_master/master.html
----------------------------------------------------------------------
diff --git a/Allura/allura/templates/jinja_master/master.html b/Allura/allura/templates/jinja_master/master.html
index ac87d77..3d94d9c 100644
--- a/Allura/allura/templates/jinja_master/master.html
+++ b/Allura/allura/templates/jinja_master/master.html
@@ -104,6 +104,7 @@
{% include g.theme.top_nav %}
{% endblock %}
</div>
+<div id="add_tool_menu"></div>
<div id="content_base">
{% block content_base %}
{% if not hide_left_bar %}