You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 19, 2018. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+7-3Lines changed: 7 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -276,7 +276,7 @@ Now your display should look like this:
276
276
<br>
277
277
You will notice that while it does display the checkboxes, you can not change them by clicking on them.
278
278
279
-
You can of course change them via the console (or the hyper-console). Try
279
+
For now we can change them via the console like we did before. Try executing
280
280
`Todo.last.update(completed: true)`
281
281
and you should see the last Todo's `completed` checkbox changing state.
282
282
@@ -312,13 +312,17 @@ end
312
312
```
313
313
*Note: If a component or tag block returns a string it is automatically wrapped in a SPAN, to insert a string in the middle you have to wrap it a SPAN like we did above.*
314
314
315
-
I hope you are starting to see a pattern here. HyperReact components determine what to display based on the `state` of some objects. External events, such as mouse clicks, the arrival of new data from the server, and even timers, update the `state`. HyperReact recomputes whatever portion of the display depends on the `state` so that the display is always in sync with the `state`. In our case the objects are the Todo model and its associated records, which has a number of associated internal `states`.
315
+
I hope you are starting to see a pattern here. HyperReact components determine what to display based on the `state` of some
316
+
objects. External events, such as mouse clicks, the arrival of new data from the server, and even timers update the `state`. HyperReact recomputes whatever portion of the display depends on the `state` so that the display is always in sync with the `state`. In our case the objects are the Todo model and its associated records, which has a number of associated internal `states`.
316
317
317
318
By the way, you don't have to use models to have states. We will see later that states can be as simple as boolean instance variables.
318
319
319
320
### Chapter 6: Routing
320
321
321
-
Now that Todos can be *completed* or *active*, we would like our user to be able display either "all" Todos, only "completed" Todos, or "active" (or incomplete) Todos. We want our URL to reflect which filter is currently being displayed. So `/all` will display all todos, `/completed` will display the completed Todos, and of course `/active` will display only active (or incomplete) Todos.
322
+
Now that Todos can be *completed* or *active*, we would like our user to be able display either "all" Todos,
323
+
only "completed" Todos, or "active" (or incomplete) Todos. We want our URL to reflect which filter is currently being displayed.
324
+
So `/all` will display all todos, `/completed` will display the completed Todos, and of course `/active` will display only active
325
+
(or incomplete) Todos. We would also like the root url `/` to be treated as `/all`
322
326
323
327
To achieve this we first need to be able to *scope* (or filter) the Todo Model. So let's edit the Todo model file so it looks like this:
0 commit comments