123456789101112131415161718192021222324252627282930313233343536373839404142 |
- Task = React.createClass({
- propTypes: {
-
-
- task: React.PropTypes.object.isRequired
- },
- toggleChecked() {
-
- Meteor.call("setChecked", this.props.task._id, ! this.props.task.checked);
- },
- deleteThisTask() {
- Meteor.call("removeTask", 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;
- }
- });
|