Skip to content

Instantly share code, notes, and snippets.

@unicolet
Created February 26, 2012 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unicolet/1918042 to your computer and use it in GitHub Desktop.
Save unicolet/1918042 to your computer and use it in GitHub Desktop.
add sc.outlet usage to todos tutorial as per ericocean's suggestion. Apply with patch -p1 < outlet.patch
diff --git a/apps/todos/main.js b/apps/todos/main.js
index 7fbd18a..06ccd2e 100644
--- a/apps/todos/main.js
+++ b/apps/todos/main.js
@@ -28,7 +28,8 @@ Todos.main = function main() {
Todos.store.find(SC.Query.local(Todos.Todo, 'isCompleted = true')));
// Focus the new todos item
- Todos.mainPage.getPath('mainPane.newTodoField.field').becomeFirstResponder();
+ Todos.mainPage.get('field').becomeFirstResponder();
+ //Todos.mainPage.getPath('mainPane.newTodoField.field').becomeFirstResponder();
} ;
diff --git a/apps/todos/resources/main_page.js b/apps/todos/resources/main_page.js
index 1bd88ba..fcdbef7 100644
--- a/apps/todos/resources/main_page.js
+++ b/apps/todos/resources/main_page.js
@@ -7,6 +7,7 @@ require('views/todo_item');
// This page describes the main user interface for your application.
Todos.mainPage = SC.Page.design({
+ field: SC.outlet('mainPane.newTodoField.field'),
// The main pane is made visible on screen as soon as your app is loaded.
// Add childViews to this pane for views to display immediately on page
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment