This commit is contained in:
Sacha Greif 2016-02-27 17:46:11 +09:00
parent ecea1e6a74
commit 3f8c5a81af
8 changed files with 17 additions and 137 deletions

View file

@ -25,11 +25,11 @@ const Header = props => {
{props.currentUser ? <p><a href={FlowRouter.path("account")}>My Account</a></p> : ""}
<ModalButton label="New Post" className="button button--primary">
<CanCreatePost user={props.currentUser}>
<CanCreatePost user={props.currentUser}>
<ModalButton label="New Post" className="button button--primary">
<NewDocContainer collection={Posts} label="New Post" methodName="posts.new" callback={(post)=>{FlowRouter.go('posts.single', post);}}/>
</CanCreatePost>
</ModalButton>
</ModalButton>
</CanCreatePost>
<FlashContainer />

View file

@ -1,60 +0,0 @@
// import Core from "meteor/nova:core";
// ({Messages, NovaForms} = Core);
// import Formsy from 'formsy-react';
// const PostNew = React.createClass({
// propTypes: {
// currentUser: React.PropTypes.object,
// postNewCallback: React.PropTypes.func,
// closeModal: React.PropTypes.func
// },
// getInitialState() {
// return {
// canSubmit: false
// }
// },
// submitForm(data) {
// // remove any empty properties
// post = _.compactObject(data);
// post = Telescope.callbacks.run("posts.new.client", post);
// Meteor.call('posts.new', post, (error, post) => {
// if (error) {
// console.log(error)
// Messages.flash(error.message, "error")
// } else {
// Messages.flash("Post created.", "success");
// FlowRouter.go('posts.single', post);
// if (this.props.closeModal) {
// this.props.closeModal();
// }
// }
// });
// },
// render() {
// ({CanCreatePost} = Telescope.components);
// const fields = Posts.simpleSchema().getEditableFields(this.props.currentUser);
// return (
// <CanCreatePost user={this.props.currentUser}>
// <div className="post-new">
// <h3>New Post</h3>
// <Formsy.Form onSubmit={this.submitForm}>
// {fields.map(fieldName => NovaForms.getComponent(fieldName, Posts.simpleSchema()._schema[fieldName]))}
// <button type="submit" className="button button--primary">Submit</button>
// </Formsy.Form>
// </div>
// </CanCreatePost>
// )
// }
// });
// module.exports = PostNew;

View file

@ -38,19 +38,19 @@ FlowRouter.route('/posts/:_id', {
}
});
FlowRouter.route('/posts/:_id/edit', {
name: 'posts.edit',
action(params, queryParams) {
({AppContainer, ItemContainer} = Telescope.components);
mount(AppContainer, {content: <ItemContainer
collection={Posts}
publication="posts.single"
selector={{_id: params._id}}
terms={params}
component={PostEdit}
><PostEdit/></ItemContainer>});
}
});
// FlowRouter.route('/posts/:_id/edit', {
// name: 'posts.edit',
// action(params, queryParams) {
// ({AppContainer, ItemContainer} = Telescope.components);
// mount(AppContainer, {content: <ItemContainer
// collection={Posts}
// publication="posts.single"
// selector={{_id: params._id}}
// terms={params}
// component={PostEdit}
// ><PostEdit/></ItemContainer>});
// }
// });
FlowRouter.route('/users/:slug', {
name: 'users.single',

View file

@ -1,2 +0,0 @@
// Telescope.registerComponent("PostNewContainer", require('./containers/PostNewContainer.jsx'));
// Telescope.registerComponent("PostEditContainer", require('./containers/PostEditContainer.jsx'));

View file

@ -1,34 +0,0 @@
// // not used anymore
// const PostEditContainer = React.createClass({
// propTypes: {
// postId: React.PropTypes.string.isRequired
// },
// mixins: [ReactMeteorData],
// getMeteorData() {
// return {
// categories: Categories.find().fetch(),
// // postUrl: Session.get("postUrl"),
// };
// },
// render() {
// ({ItemContainer, PostEdit} = Telescope.components);
// return (
// <ItemContainer
// propsToPass={this.data}
// collection={Posts}
// publication="posts.single"
// terms={{_id: this.props.postId}}
// component={PostEdit}
// />
// )
// }
// });
// module.exports = PostEditContainer;

View file

@ -1,22 +0,0 @@
// // not used anymore
// const PostNewContainer = React.createClass({
// mixins: [ReactMeteorData],
// getMeteorData() {
// return {
// // postUrl: Session.get("postUrl"), // replace with state?
// currentUser: Meteor.user()
// };
// },
// render() {
// ({PostNew} = Telescope.components);
// return <PostNew {...this.props} {...this.data} />;
// }
// });
// module.exports = PostNewContainer;

View file

@ -77,7 +77,6 @@ Meteor.publish('posts.list', function (terms) {
const posts = Posts.find(selector, options);
const users = getPostsListUsers(posts);
return Users.can.view(currentUser) ? [posts, users] : [];
// });

View file

@ -29,7 +29,6 @@ Package.onUse(function (api) {
'lib/config.js',
'lib/collection.js',
'lib/parameters.js',
'lib/components.js',
'lib/notifications.js',
'lib/views.js',
'lib/helpers.js',