1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- Task = React.createClass({
- propTypes: {
-
-
- task: React.PropTypes.object.isRequired
- },
- toggleChecked() {
-
- Tasks.update(this.props.task._id, {
- $set: { checked: !this.props.task.checked }
- });
- },
- deleteThisTask() {
- Tasks.remove(this.props.task._id);
- },
- render() {
-
-
- const taskClassName = this.props.task.checked ? 'checked' : '';
- let result = (
- <li className={taskClassName}>
- <button className="delete" onClick={this.deleteThisTask}>
- ×
- </button>
- <input
- type="checkbox"
- readOnly="{true}"
- checked={this.props.task.checked}
- onClick={this.toggleChecked}
- />
- <strong>{this.props.task.username}</strong>: <span className="text">{this.props.task.text}</span>
- </li>
- );
- return result;
- }
- });
|