| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library todo_row; | 5 library todo_row; |
| 6 | 6 |
| 7 import 'package:observe/observe.dart'; | 7 import 'package:observe/observe.dart'; |
| 8 import 'package:polymer/polymer.dart'; | 8 import 'package:polymer/polymer.dart'; |
| 9 import 'model.dart'; | 9 import 'model.dart'; |
| 10 | 10 |
| 11 class TodoRow extends PolymerElement with ObservableMixin { | 11 class TodoRow extends PolymerElement with ObservableMixin { |
| 12 @observable Todo todo; | 12 @observable Todo todo; |
| 13 | 13 |
| 14 bool get applyAuthorStyles => true; | 14 bool get applyAuthorStyles => true; |
| 15 ScopedCssMapper get css => getScopedCss("todo-row"); | 15 |
| 16 // TODO(sigmund,terry): bring back scoped-css polyfills |
| 16 | 17 |
| 17 created() { | 18 created() { |
| 18 super.created(); | 19 super.created(); |
| 19 var root = getShadowRoot("todo-row"); | 20 var root = getShadowRoot("todo-row"); |
| 20 var label = root.query('#label').xtag; | 21 var label = root.query('#label').xtag; |
| 21 var item = root.query('.' + css['.todo-item']); | 22 var item = root.query('.todo-item'); |
| 22 | 23 |
| 23 bindCssClass(item, css['.completed'], this, 'todo.done'); | 24 bindCssClass(item, 'completed', this, 'todo.done'); |
| 24 bindCssClass(item, css['.editing'], label, 'editing'); | 25 bindCssClass(item, 'editing', label, 'editing'); |
| 25 } | 26 } |
| 26 | 27 |
| 27 void removeTodo() => appModel.todos.remove(todo); | 28 void removeTodo() => appModel.todos.remove(todo); |
| 28 } | 29 } |
| 30 |
| 31 _init() { |
| 32 registerPolymerElement('todo-row', () => new TodoRow()); |
| 33 } |
| OLD | NEW |