Move admin options

This commit is contained in:
Chris Blanchard 2015-08-18 12:02:27 +01:00
parent 539b10056e
commit f1d1a7b622
3 changed files with 70 additions and 43 deletions

View file

@ -80,20 +80,18 @@ var AdminPanel = React.createClass({
render() {
return (
<ul className="nav" id="admin-menu">
<li>
<div className="admin-panel">
<h5>Admin</h5>
<div>
<h5>Swap Into a Different Account</h5>
<UserLogin />
<h5>Gather Options</h5>
<div>
<button
className="btn btn-danger max-width"
onClick={this.handleGatherReset}>
Reset Gather</button>
<p className="text-center add-top"><small>Only responds for admins on staging.ensl.org</small></p>
</div>
</li>
</ul>
)
</div>
);
}
});
@ -106,6 +104,14 @@ var CurrentUser = React.createClass({
render() {
if (this.props.user) {
var adminOptions;
if (this.props.user.admin) {
adminOptions = (
<li>
<a href="#" data-toggle="modal" data-target="#adminmodal">Administration</a>
</li>
)
}
return (
<li className="dropdown">
<a className="dropdown-toggle" data-toggle="dropdown" href="#">
@ -127,6 +133,7 @@ var CurrentUser = React.createClass({
<li>
<a href="#" data-toggle="modal" data-target="#designmodal">Design Goals</a>
</li>
{adminOptions}
</ul>
</li>

View file

@ -1280,36 +1280,28 @@ var AdminPanel = React.createClass({
render: function render() {
return React.createElement(
"ul",
{ className: "nav", id: "admin-menu" },
React.createElement(
"li",
null,
React.createElement(
"div",
{ className: "admin-panel" },
null,
React.createElement(
"h5",
null,
"Admin"
"Swap Into a Different Account"
),
React.createElement(UserLogin, null),
React.createElement(
"h5",
null,
"Gather Options"
),
React.createElement(
"div",
null,
React.createElement(
"button",
{
className: "btn btn-danger max-width",
onClick: this.handleGatherReset },
"Reset Gather"
),
React.createElement(
"p",
{ className: "text-center add-top" },
React.createElement(
"small",
null,
"Only responds for admins on staging.ensl.org"
)
)
)
)
);
@ -1329,6 +1321,18 @@ var CurrentUser = React.createClass({
render: function render() {
if (this.props.user) {
var adminOptions;
if (this.props.user.admin) {
adminOptions = React.createElement(
"li",
null,
React.createElement(
"a",
{ href: "#", "data-toggle": "modal", "data-target": "#adminmodal" },
"Administration"
)
);
}
return React.createElement(
"li",
{ className: "dropdown" },
@ -1385,7 +1389,8 @@ var CurrentUser = React.createClass({
{ href: "#", "data-toggle": "modal", "data-target": "#designmodal" },
"Design Goals"
)
)
),
adminOptions
)
);
} else {

View file

@ -24,6 +24,22 @@
</div>
</div>
<div class="modal fade" id="adminmodal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Administration Panel</h4>
</div>
<div class="modal-body" id="admin-menu">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
@ -41,7 +57,6 @@
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu"></ul>
<ul class="nav" id="admin-menu"></ul>
</div>
</div>
</nav>