mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
get rid of PostNewContainer and PostEditContainer
This commit is contained in:
parent
13df8f5df7
commit
50b0c57de3
7 changed files with 73 additions and 49 deletions
|
@ -3,7 +3,7 @@ import NoSSR from 'react-no-ssr';
|
||||||
|
|
||||||
const Header = props => {
|
const Header = props => {
|
||||||
|
|
||||||
({Logo, ListContainer, CategoriesList, FlashContainer, NewPostButton, ModalButton, PostNewContainer} = Telescope.components);
|
({Logo, ListContainer, CategoriesList, FlashContainer, NewPostButton, ModalButton, PostNewContainer, CurrentUserContainer, PostNew} = Telescope.components);
|
||||||
|
|
||||||
const logoUrl = Telescope.settings.get("logoUrl");
|
const logoUrl = Telescope.settings.get("logoUrl");
|
||||||
const siteTitle = Telescope.settings.get("title", "Telescope");
|
const siteTitle = Telescope.settings.get("title", "Telescope");
|
||||||
|
@ -25,7 +25,7 @@ const Header = props => {
|
||||||
|
|
||||||
{props.currentUser ? <p><a href={FlowRouter.path("account")}>My Account</a></p> : ""}
|
{props.currentUser ? <p><a href={FlowRouter.path("account")}>My Account</a></p> : ""}
|
||||||
|
|
||||||
<ModalButton label="New Post" className="button button--primary"><PostNewContainer/></ModalButton>
|
<ModalButton label="New Post" className="button button--primary"><CurrentUserContainer><PostNew /></CurrentUserContainer></ModalButton>
|
||||||
|
|
||||||
<FlashContainer />
|
<FlashContainer />
|
||||||
|
|
||||||
|
|
|
@ -27,8 +27,8 @@ FlowRouter.route('/', {
|
||||||
FlowRouter.route('/posts/new', {
|
FlowRouter.route('/posts/new', {
|
||||||
name: 'posts.new',
|
name: 'posts.new',
|
||||||
action(params, queryParams) {
|
action(params, queryParams) {
|
||||||
({AppContainer, PostNewContainer} = Telescope.components);
|
({AppContainer, CurrentUserContainer, PostNew} = Telescope.components);
|
||||||
mount(AppContainer, {content: <PostNewContainer />});
|
mount(AppContainer, {content: <CurrentUserContainer><PostNew /></CurrentUserContainer>});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -50,8 +50,13 @@ FlowRouter.route('/posts/:_id', {
|
||||||
FlowRouter.route('/posts/:_id/edit', {
|
FlowRouter.route('/posts/:_id/edit', {
|
||||||
name: 'posts.edit',
|
name: 'posts.edit',
|
||||||
action(params, queryParams) {
|
action(params, queryParams) {
|
||||||
({AppContainer, PostEditContainer} = Telescope.components);
|
({AppContainer, ItemContainer} = Telescope.components);
|
||||||
mount(AppContainer, {content: <PostEditContainer postId={params._id}/>});
|
mount(AppContainer, {content: <ItemContainer
|
||||||
|
collection={Posts}
|
||||||
|
publication="posts.single"
|
||||||
|
terms={{_id: params._id}}
|
||||||
|
component={PostEdit}
|
||||||
|
/>});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,6 @@ Telescope.registerComponent("AppContainer", require('./containers/AppContainer.j
|
||||||
Telescope.registerComponent("ItemContainer", require('./containers/ItemContainer.jsx'));
|
Telescope.registerComponent("ItemContainer", require('./containers/ItemContainer.jsx'));
|
||||||
Telescope.registerComponent("ListContainer", require('./containers/ListContainer.jsx'));
|
Telescope.registerComponent("ListContainer", require('./containers/ListContainer.jsx'));
|
||||||
Telescope.registerComponent("FlashContainer", require('./containers/FlashContainer.jsx'));
|
Telescope.registerComponent("FlashContainer", require('./containers/FlashContainer.jsx'));
|
||||||
|
Telescope.registerComponent("CurrentUserContainer", require('./containers/CurrentUserContainer.jsx'));
|
||||||
|
|
||||||
Telescope.registerComponent("ModalButton", require('./components/ModalButton.jsx'));
|
Telescope.registerComponent("ModalButton", require('./components/ModalButton.jsx'));
|
18
packages/nova-core/lib/containers/CurrentUserContainer.jsx
Normal file
18
packages/nova-core/lib/containers/CurrentUserContainer.jsx
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
const CurrentUserContainer = React.createClass({
|
||||||
|
|
||||||
|
mixins: [ReactMeteorData],
|
||||||
|
|
||||||
|
getMeteorData() {
|
||||||
|
|
||||||
|
return {
|
||||||
|
currentUser: Meteor.user()
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return React.cloneElement(this.props.children, { currentUser: this.data.currentUser });
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = CurrentUserContainer;
|
|
@ -1,2 +1,2 @@
|
||||||
Telescope.registerComponent("PostNewContainer", require('./containers/PostNewContainer.jsx'));
|
// Telescope.registerComponent("PostNewContainer", require('./containers/PostNewContainer.jsx'));
|
||||||
Telescope.registerComponent("PostEditContainer", require('./containers/PostEditContainer.jsx'));
|
// Telescope.registerComponent("PostEditContainer", require('./containers/PostEditContainer.jsx'));
|
||||||
|
|
|
@ -1,34 +1,34 @@
|
||||||
// import React from 'react';
|
// // not used anymore
|
||||||
|
|
||||||
const PostEditContainer = React.createClass({
|
// const PostEditContainer = React.createClass({
|
||||||
|
|
||||||
propTypes: {
|
// propTypes: {
|
||||||
postId: React.PropTypes.string.isRequired
|
// postId: React.PropTypes.string.isRequired
|
||||||
},
|
// },
|
||||||
|
|
||||||
mixins: [ReactMeteorData],
|
// mixins: [ReactMeteorData],
|
||||||
|
|
||||||
getMeteorData() {
|
// getMeteorData() {
|
||||||
return {
|
// return {
|
||||||
categories: Categories.find().fetch(),
|
// categories: Categories.find().fetch(),
|
||||||
// postUrl: Session.get("postUrl"),
|
// // postUrl: Session.get("postUrl"),
|
||||||
};
|
// };
|
||||||
},
|
// },
|
||||||
|
|
||||||
render() {
|
// render() {
|
||||||
({ItemContainer, PostEdit} = Telescope.components);
|
// ({ItemContainer, PostEdit} = Telescope.components);
|
||||||
|
|
||||||
return (
|
// return (
|
||||||
<ItemContainer
|
// <ItemContainer
|
||||||
propsToPass={this.data}
|
// propsToPass={this.data}
|
||||||
collection={Posts}
|
// collection={Posts}
|
||||||
publication="posts.single"
|
// publication="posts.single"
|
||||||
terms={{_id: this.props.postId}}
|
// terms={{_id: this.props.postId}}
|
||||||
component={PostEdit}
|
// component={PostEdit}
|
||||||
/>
|
// />
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
|
|
||||||
});
|
// });
|
||||||
|
|
||||||
module.exports = PostEditContainer;
|
// module.exports = PostEditContainer;
|
|
@ -1,22 +1,22 @@
|
||||||
// import React from 'react';
|
// // not used anymore
|
||||||
|
|
||||||
const PostNewContainer = React.createClass({
|
// const PostNewContainer = React.createClass({
|
||||||
|
|
||||||
mixins: [ReactMeteorData],
|
// mixins: [ReactMeteorData],
|
||||||
|
|
||||||
getMeteorData() {
|
// getMeteorData() {
|
||||||
|
|
||||||
return {
|
// return {
|
||||||
// postUrl: Session.get("postUrl"), // replace with state?
|
// // postUrl: Session.get("postUrl"), // replace with state?
|
||||||
currentUser: Meteor.user()
|
// currentUser: Meteor.user()
|
||||||
};
|
// };
|
||||||
},
|
// },
|
||||||
|
|
||||||
render() {
|
// render() {
|
||||||
({PostNew} = Telescope.components);
|
// ({PostNew} = Telescope.components);
|
||||||
return <PostNew {...this.props} {...this.data} />;
|
// return <PostNew {...this.props} {...this.data} />;
|
||||||
}
|
// }
|
||||||
|
|
||||||
});
|
// });
|
||||||
|
|
||||||
module.exports = PostNewContainer;
|
// module.exports = PostNewContainer;
|
Loading…
Add table
Reference in a new issue