Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1628 Move Toolbar & Admin View is Dashboard #1723

Merged
merged 30 commits into from
Jan 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
c7c5cc5
Moving toolbars
mikemurray Jan 9, 2017
78acd66
Adding react switch control
mikemurray Jan 10, 2017
61bc35e
Merge branch 'development' into 1628-move-toolbars
mikemurray Jan 10, 2017
af551f9
Improve layout and styles for switch component
mikemurray Jan 11, 2017
c0215ab
Merge branch 'development' into 1628-move-toolbars
mikemurray Jan 11, 2017
e1f7495
Clean up styles related to publish bar
mikemurray Jan 12, 2017
e61cf80
Toolbar reorg (#1713)
mikemurray Jan 13, 2017
5c3cc31
Added blaze react package
mikemurray Jan 13, 2017
bf8d1a2
Merge branch 'release-0.19.0' into 1628-move-toolbars
mikemurray Jan 13, 2017
831d101
Added admin context provider
mikemurray Jan 13, 2017
e963b9f
CSS-IN-JS styles for admin view header with animations
mikemurray Jan 13, 2017
b9b90e9
Merge branch 'release-0.19.0' into 1628-move-toolbars
mikemurray Jan 13, 2017
abf0b62
Added add product button
mikemurray Jan 13, 2017
852be1c
Package list re-org
mikemurray Jan 16, 2017
ff4b2c2
Filter entries with a template
mikemurray Jan 16, 2017
cf161d5
Added detail view to action view
mikemurray Jan 16, 2017
d7d7fcb
cleanup
mikemurray Jan 17, 2017
35553a4
Merge branch 'release-0.19.0' into 1628-move-toolbars
mikemurray Jan 17, 2017
40ccfa5
Fix for missing grid settings view in action view
mikemurray Jan 17, 2017
fe16197
Split generic toolbar and publish bar functionality
mikemurray Jan 18, 2017
e914e08
Fix action view close on orders view
mikemurray Jan 18, 2017
70ea895
Cleanup
mikemurray Jan 18, 2017
a50435b
Cleanup
mikemurray Jan 18, 2017
1be85a9
Open shipping details in action detail view
mikemurray Jan 18, 2017
a3c385b
Moved add product functionality to generic admin toolbar
mikemurray Jan 18, 2017
4a8510e
Only show vertical divider if there is a dashboardHeaderTemplate
mikemurray Jan 18, 2017
a281514
Allow for no loading templates
mikemurray Jan 18, 2017
aa76d7d
Clear action view on close to prevent odd behavior. Will revisit.
mikemurray Jan 18, 2017
633e4b6
Fixed broken preview toggle
mikemurray Jan 18, 2017
91f5cae
Fix archive product. Should pass full product object, not _id
mikemurray Jan 18, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,4 @@ johanbrook:publication-collector


# Custom Packages
gadicc:blaze-react-component
1 change: 1 addition & 0 deletions .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ [email protected]
[email protected]
[email protected]
[email protected]
gadicc:[email protected]
[email protected]
[email protected]
[email protected]
Expand Down
5 changes: 4 additions & 1 deletion client/modules/accounts/templates/dropdown/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ Template.loginDropdown.events({
});
}
});
} else if (this.route || this.name) {
} else if (this.name !== "account/profile") {
event.preventDefault();
/** TMP **/
Reaction.showActionView(this);
} else if (this.route || this.name) {
const route = this.name || this.route;
Reaction.Router.go(route);
}
Expand Down
92 changes: 88 additions & 4 deletions client/modules/core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ export default {

setActionView(viewData) {
if (viewData) {
Session.set("admin/actionView", viewData);
Session.set("admin/actionView", [viewData]);
} else {
const registryItem = this.getRegistryForCurrentRoute(
"settings");
Expand All @@ -266,19 +266,103 @@ export default {
}
},

pushActionView(viewData) {
Session.set("admin/showActionView", true);

const actionViewStack = Session.get("admin/actionView");

if (viewData) {
actionViewStack.push(viewData);
Session.set("admin/actionView", actionViewStack);
} else {
const registryItem = this.getRegistryForCurrentRoute(
"settings");

if (registryItem) {
this.pushActionView(registryItem);
} else {
this.pushActionView({ template: "blankControls" });
}
}
},

isActionViewAtRootView() {
const actionViewStack = Session.get("admin/actionView");

if (Array.isArray(actionViewStack) && actionViewStack.length === 1) {
return true;
}

return false;
},

popActionView() {
const actionViewStack = Session.get("admin/actionView");
actionViewStack.pop();

Session.set("admin/actionView", actionViewStack);

this.setActionViewDetail({});
},

setActionViewDetail(viewData) {
if (viewData) {
Session.set("admin/detailView", [viewData]);
}
},

pushActionViewDetail(viewData) {
Session.set("admin/showActionView", true);

const detailViewStack = Session.get("admin/detailView");

if (viewData) {
detailViewStack.push(viewData);
Session.set("admin/detailView", detailViewStack);
}
},

popActionViewDetail() {
const detailViewStack = Session.get("admin/detailView");
detailViewStack.pop();

Session.set("admin/detailView", detailViewStack);
},

getActionView() {
return Session.get("admin/actionView") || {};
const actionViewStack = Session.get("admin/actionView");

if (Array.isArray(actionViewStack) && actionViewStack.length) {
return actionViewStack.pop();
}

return {};
},

getActionViewDetail() {
const detailViewStack = Session.get("admin/detailView");

if (Array.isArray(detailViewStack) && detailViewStack.length) {
return detailViewStack.pop();
}

return {};
},

hideActionView() {
Session.set("admin/showActionView", false);
this.clearActionView();
},

clearActionView() {
Session.set("admin/actionView", {
Session.set("admin/actionView", [{
label: "",
i18nKeyLabel: ""
});
}]);
Session.set("admin/detailView", [{
label: "",
i18nKeyLabel: ""
}]);
},

getCurrentTag() {
Expand Down
232 changes: 232 additions & 0 deletions imports/plugins/core/dashboard/client/components/actionView.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
import React, { Component, PropTypes } from "react";
import classnames from "classnames";
import Blaze from "meteor/gadicc:blaze-react-component";
import {
IconButton,
Translation
} from "/imports/plugins/core/ui/client/components";
import { Admin } from "/imports/plugins/core/ui/client/providers";
import Radium from "radium";
import Velocity from "velocity-animate";
import "velocity-animate/velocity.ui";
import { VelocityTransitionGroup } from "velocity-react";

const getStyles = (props) => {
let viewSize = 400;
// if (props.actionView && props.actionView.priority === 1 && props.actionView.provides === "dashboard") {
if (props.actionView && props.actionView.provides === "dashboard") {
viewSize = "90vw";
}

if (props.actionViewIsOpen === false) {
viewSize = 0;
}

return {
base: {
display: "flex",
flexDirection: "column",
height: "100vh",
position: "relative",
width: viewSize
},
header: {
display: "flex",
alignItems: "center",
position: "relative",
height: "56px",
padding: "0 20px",
margin: 0
},
heading: {
display: "flex",
alignItems: "center",
flex: "1 1 auto",
position: "relative",
margin: 0,
height: "100%"
},
body: {
display: "flex",
webkitOverflowScrolling: "touch"
},
masterView: {
flex: "1 1 auto",
height: "100%",
overflow: "auto",
webkitOverflowScrolling: "touch"
},
detailView: {
width: "400px",
height: "100%",
overflow: "auto",
webkitOverflowScrolling: "touch"
},
title: {
margin: 0,
transition: "200ms all"
},
titleWithBackButton: {
paddingLeft: 40
},
backButton: {
height: "100%",
position: "absolute",
top: 0,
zIndex: 1
},
backButtonContainers: {
display: "flex",
alignItems: "center",
height: "100%"
}
};
};

class ActionView extends Component {
static propTypes = {
actionView: PropTypes.object,
actionViewIsOpen: PropTypes.bool,
buttons: PropTypes.array,
isActionViewAtRootView: PropTypes.bool
}

renderControlComponent() {
if (this.props.actionView && typeof this.props.actionView.template === "string") {
return (
<div style={this.styles.masterView} className="master">
<Blaze
{...this.props.actionView.data}
template={this.props.actionView.template}
/>
</div>
);
}

return null;
}

renderDetailComponent() {
if (this.props.detailView && typeof this.props.detailView.template === "string") {
return (
<div style={this.styles.detailView} className="detail">
<Blaze
{...this.props.detailView.data}
template={this.props.detailView.template}
/>
</div>
);
}

return null;
}

renderFooter() {
// if (this.props.footerTemplate) {
// return (
// <Blaze template={this.props.footerTemplate} />
// );
// }
}

renderBackButton() {
if (this.props.isActionViewAtRootView === false) {
return (
<div style={this.styles.backButton}>
<div style={this.styles.backButtonContainers}>
<IconButton
icon="fa fa-arrow-left"
onClick={this.props.handleActionViewBack}
/>
</div>
</div>
);
}
}

get styles() {
return getStyles(this.props);
}

get backButtonEnterAnimation() {
return {
animation: {
display: "flex",
position: "absolute",
left: 20,
opaticy: 1
},
duration: 200
};
}

get backButtonLeaveAnimaton() {
return {
animation: {
display: "flex",
position: "absolute",
left: -30,
opaticy: 0
},
duration: 200

};
}

render() {
const { actionView } = this.props;
const baseClassName = classnames({
"admin-controls": true,
"show-settings": this.props.actionViewIsOpen
});


return (
<div style={this.styles.base} className={baseClassName}>
<div style={this.styles.header} className="admin-controls-heading--">
<VelocityTransitionGroup
enter={this.backButtonEnterAnimation}
leave={this.backButtonLeaveAnimaton}
>
{this.renderBackButton()}
</VelocityTransitionGroup>

<div style={this.styles.heading} className="nav-settings-heading--">
<h3
className="nav-settings-title--"
style={[
this.styles.title,
!this.props.isActionViewAtRootView ? this.styles.titleWithBackButton : {}
]}
>
<Translation
defaultValue={actionView.label || "Dashboard"}
i18nKey={actionView.i18nKeyLabel || "dashboard.coreTitle"}
/>
</h3>
</div>

<div className="nav-settings-controls--">
<IconButton
icon="fa fa-times"
onClick={this.props.handleActionViewClose}
/>
</div>
</div>
<div style={this.styles.body} className="admin-controls-content action-view-body">

{this.renderControlComponent()}
{this.renderDetailComponent()}
</div>
<div className="admin-controls-footer">
<div className="admin-controls-container">
{this.renderFooter()}
</div>
</div>

</div>
);
}
}

export default Admin()(Radium(ActionView));
3 changes: 3 additions & 0 deletions imports/plugins/core/dashboard/client/components/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { default as ActionView } from "./actionView";
export { default as PackageList } from "./packageList";
export { default as Toolbar } from "./toolbar";
Loading