2017-03-18 16:04:27 +09:00
|
|
|
|
/*
|
|
|
|
|
|
|
|
|
|
An item in the movies list.
|
|
|
|
|
Wrapped with the "withCurrentUser" container.
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React, { PropTypes, Component } from 'react';
|
2017-03-23 16:27:59 +09:00
|
|
|
|
import { registerComponent, ModalTrigger } from 'meteor/vulcan:core';
|
2017-03-18 16:04:27 +09:00
|
|
|
|
|
|
|
|
|
import Movies from '../../modules/movies/collection.js';
|
|
|
|
|
import MoviesEditForm from './MoviesEditForm.jsx';
|
|
|
|
|
|
|
|
|
|
const MoviesItem = ({movie, currentUser}) =>
|
|
|
|
|
|
2017-03-23 12:24:12 +09:00
|
|
|
|
<div style={{paddingBottom: "15px",marginBottom: "15px", borderBottom: "1px solid #ccc"}}>
|
2017-03-18 16:04:27 +09:00
|
|
|
|
|
|
|
|
|
{/* document properties */}
|
|
|
|
|
|
2017-03-24 10:15:48 +09:00
|
|
|
|
<h4>{movie.name} ({movie.year})</h4>
|
|
|
|
|
<p>{movie.review} – {movie.user && movie.user.displayName}</p>
|
2017-03-18 16:04:27 +09:00
|
|
|
|
|
|
|
|
|
{/* edit document form */}
|
|
|
|
|
|
|
|
|
|
{Movies.options.mutations.edit.check(currentUser, movie) ?
|
|
|
|
|
<ModalTrigger label="Edit Movie">
|
|
|
|
|
<MoviesEditForm currentUser={currentUser} documentId={movie._id} />
|
|
|
|
|
</ModalTrigger>
|
|
|
|
|
: null
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
export default MoviesItem;
|