Skip to content

Instantly share code, notes, and snippets.

@MikailCliftov
Created March 8, 2011 03:33
Show Gist options
  • Save MikailCliftov/859808 to your computer and use it in GitHub Desktop.
Save MikailCliftov/859808 to your computer and use it in GitHub Desktop.
Custom View: This works
Todos.ScrollingList = SC.View.extend(
/** @scope Todos.ScrollingList.prototype */ {
render: function(context){
var template = SC.TEMPLATES['todos']();
context.push(template);
}
});
working template:
<h1>Todos</h1>
Kaboom template:
<h1>Todos</h1>
{{#view "Todos.CreateTodoView"}}
<input id="new-todo" type="text" placeholder="Wot?" >
{{/view}}
Todos.CreateTodoView is defined:
Todos.CreateTodoView = SC.TemplateView.create(SC.TextFieldSupport, {
insertNewline: function() {
var value = this.get('value');
if (value) {
Todos.todoListController.createTodo(value);
this.set('value', '');
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment