From a58c8eb27ce7bfbecac4e21984a4444b8e7fdc56 Mon Sep 17 00:00:00 2001 From: Rishabh Rao Date: Fri, 15 Jun 2012 13:08:33 +0530 Subject: [PATCH 1/2] Under Exercise 3, the example for readCount was not using syntax highlighting. Also, changed .property('@each') to .property('@each.read'). --- Docs/Instructions.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Docs/Instructions.md b/Docs/Instructions.md index dd81929..13e9e86 100644 --- a/Docs/Instructions.md +++ b/Docs/Instructions.md @@ -121,10 +121,11 @@ In this exercise, we'll add some additional properties to our controller so we c ### Step 1: Add additional properties to the dataController We want to show the number of items that are in our data controller, including the total count, how many have been read, how many are unread, and how many are starred. Ember allows us to make a function act like a property by adding `.property()` to the end of the function. The value we pass to the property function tells Ember when the specified item is updated, it needs to update the value of the property. -Let's look at an example for readCount: +Let's look at an example for the `readCount` method: + readCount: function() { - return 1; - }.property('@each') + return 1; + }.property('@each.read') Right now, it simply returns 1, but we want it to return the number of read items in our data controller. To do that, we need to get the list of read items, and then get the length of that filtered list. Ember provides an easy way to filter objects with the `filterProperty(name, value)` function. Let's replace the `return 1;` with `return this.filterProperty('read', true).get('length');` From d8070998aca878f8ea4a4f4a8d62cc5974eb743f Mon Sep 17 00:00:00 2001 From: Rishabh Rao Date: Fri, 15 Jun 2012 15:42:50 +0530 Subject: [PATCH 2/2] Split Exercise 3.4 into 3.4a and 3.4b. --- Exercise03/js/app.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Exercise03/js/app.js b/Exercise03/js/app.js index 171174e..885001c 100755 --- a/Exercise03/js/app.js +++ b/Exercise03/js/app.js @@ -1,6 +1,5 @@ - // Create the all up Ember application var WReader = Em.Application.create({ ready: function() { @@ -73,7 +72,9 @@ WReader.SummaryListView = Em.View.extend({ tagName: 'article', classNames: ['well', 'summary'] - /* Exercise 3.4 */ + /* Exercise 3.4a */ + + /* Exercise 3.4b */ /* Exercise 3.5 */