This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/Task.jsx b/imports/ui/Task.jsx | |
index ee040c5..deba74a 100644 | |
--- a/imports/ui/Task.jsx | |
+++ b/imports/ui/Task.jsx | |
@@ -42,4 +42,5 @@ Task.propTypes = { | |
// This component gets the task to display through a React prop. | |
// We can use propTypes to indicate it is required | |
task: PropTypes.object.isRequired, | |
+ showPrivateButton: React.PropTypes.bool.isRequired, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx | |
index d6e5f0a..06262c5 100644 | |
--- a/imports/ui/App.jsx | |
+++ b/imports/ui/App.jsx | |
@@ -41,9 +41,18 @@ class App extends Component { | |
if (this.state.hideCompleted) { | |
filteredTasks = filteredTasks.filter(task => !task.checked); | |
} | |
- return filteredTasks.map((task) => ( | |
- <Task key={task._id} task={task} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index 234a839..f1d2c92 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -38,4 +38,17 @@ Meteor.methods({ | |
Tasks.update(taskId, { $set: { checked: setChecked } }); | |
}, | |
+ 'tasks.setPrivate'(taskId, setToPrivate) { | |
+ check(taskId, String); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx | |
index 4f41c39..d6e5f0a 100644 | |
--- a/imports/ui/App.jsx | |
+++ b/imports/ui/App.jsx | |
@@ -90,6 +90,8 @@ App.propTypes = { | |
}; | |
export default createContainer(() => { | |
+ Meteor.subscribe('tasks'); | |
+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index 0201eb4..234a839 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -4,6 +4,13 @@ import { check } from 'meteor/check'; | |
export const Tasks = new Mongo.Collection('tasks'); | |
+if (Meteor.isServer) { | |
+ // This code only runs on the server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/Task.jsx b/imports/ui/Task.jsx | |
index 5650fa0..ee040c5 100644 | |
--- a/imports/ui/Task.jsx | |
+++ b/imports/ui/Task.jsx | |
@@ -1,18 +1,15 @@ | |
import React, { Component, PropTypes } from 'react'; | |
- | |
-import { Tasks } from '../api/tasks.js'; | |
+import { Meteor } from 'meteor/meteor'; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx | |
index bbbb728..4f41c39 100644 | |
--- a/imports/ui/App.jsx | |
+++ b/imports/ui/App.jsx | |
@@ -24,12 +24,7 @@ class App extends Component { | |
// Find the text field via the React ref | |
const text = ReactDOM.findDOMNode(this.refs.textInput).value.trim(); | |
- Tasks.insert({ | |
- text, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/api/tasks.js b/imports/api/tasks.js | |
index 3bed819..0201eb4 100644 | |
--- a/imports/api/tasks.js | |
+++ b/imports/api/tasks.js | |
@@ -1,3 +1,34 @@ | |
+import { Meteor } from 'meteor/meteor'; | |
import { Mongo } from 'meteor/mongo'; | |
+import { check } from 'meteor/check'; | |
export const Tasks = new Mongo.Collection('tasks'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/Task.jsx b/imports/ui/Task.jsx | |
index 3140871..5650fa0 100644 | |
--- a/imports/ui/Task.jsx | |
+++ b/imports/ui/Task.jsx | |
@@ -33,7 +33,9 @@ export default class Task extends Component { | |
onClick={this.toggleChecked.bind(this)} | |
/> | |
- <span className="text">{this.props.task.text}</span> | |
+ <span className="text"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/imports/ui/App.jsx b/imports/ui/App.jsx | |
index ce0b541..bbbb728 100644 | |
--- a/imports/ui/App.jsx | |
+++ b/imports/ui/App.jsx | |
@@ -69,13 +69,15 @@ class App extends Component { | |
<AccountsUIWrapper /> | |
- <form className="new-task" onSubmit={this.handleSubmit.bind(this)} > | |
- <input |