OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 3 Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
4 for details. All rights reserved. Use of this source code is governed by a | 4 for details. All rights reserved. Use of this source code is governed by a |
5 BSD-style license that can be found in the LICENSE file. | 5 BSD-style license that can be found in the LICENSE file. |
6 --> | 6 --> |
7 <html> | 7 <html> |
8 <head> | 8 <head> |
9 <meta charset="utf-8"> | 9 <meta charset="utf-8"> |
10 <link rel="import" href="editable_label.html"> | 10 <link rel="import" href="editable_label.html"> |
11 </head> | 11 </head> |
12 <body> | 12 <body> |
13 <element name="todo-row" extends="li" apply-author-styles> | 13 <polymer-element name="todo-row" extends="li" attributes="todo"> |
14 <template> | 14 <template> |
15 <style scoped> | 15 <style scoped> |
16 .todo-item { | 16 .todo-item { |
17 position: relative; | 17 position: relative; |
18 font-size: 24px; | 18 font-size: 24px; |
19 border-bottom: 1px dotted #ccc; | 19 border-bottom: 1px dotted #ccc; |
20 } | 20 } |
21 | 21 |
22 .todo-item.editing { | 22 .todo-item.editing { |
23 border-bottom: none; | 23 border-bottom: none; |
24 padding: 0; | 24 padding: 0; |
25 } | 25 } |
26 | 26 |
27 /* | 27 /* |
28 TODO(jmesserly): the ".todo-item label" selector does not work with real | 28 TODO(jmesserly): the ".todo-item label" selector does not work with real |
29 ShadowRoot because it crosses the shadow boundary. | 29 ShadowRoot because it crosses the shadow boundary. |
30 */ | 30 */ |
31 .todo-item.completed editable-label { | 31 .todo-item.completed [is=editable-label] { |
32 color: #a9a9a9; | 32 color: #a9a9a9; |
33 text-decoration: line-through; | 33 text-decoration: line-through; |
34 } | 34 } |
35 | 35 |
36 .todo-item .toggle { | 36 .todo-item .toggle { |
37 text-align: center; | 37 text-align: center; |
38 width: 40px; | 38 width: 40px; |
39 /* auto, since non-WebKit browsers don't support input styling */ | 39 /* auto, since non-WebKit browsers don't support input styling */ |
40 height: auto; | 40 height: auto; |
41 position: absolute; | 41 position: absolute; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 */ | 115 */ |
116 @media screen and (-webkit-min-device-pixel-ratio:0) { | 116 @media screen and (-webkit-min-device-pixel-ratio:0) { |
117 .todo-item .toggle { | 117 .todo-item .toggle { |
118 background: none; | 118 background: none; |
119 } | 119 } |
120 #todo-item .toggle { | 120 #todo-item .toggle { |
121 height: 40px; | 121 height: 40px; |
122 } | 122 } |
123 } | 123 } |
124 </style> | 124 </style> |
125 <div class="todo-item {{_editingClass}} {{_completedClass}}"> | 125 <div class="todo-item"> |
126 <input class="toggle" type="checkbox" bind-checked="todo.done"> | 126 <input class="toggle" type="checkbox" checked="{{todo.done}}"> |
127 <editable-label id="label" bind-value="todo.task"></editable-label> | 127 <editable-label id="label" value="{{todo.task}}"></editable-label> |
128 <button class="destroy" on-click="app.todos.remove(todo)"></button> | 128 <button class="destroy" on-click="removeTodo"></button> |
129 </div> | 129 </div> |
130 </template> | 130 </template> |
131 <script type="application/dart"> | 131 <script type="application/dart" src="todo_row.dart"></script> |
132 import 'package:web_ui/web_ui.dart'; | 132 </polymer-element> |
133 import 'model.dart'; | |
134 | |
135 @observable | |
136 class TodoRow extends WebComponent { | |
137 Todo todo; | |
138 | |
139 ScopedCssMapper get css => getScopedCss("todo-row"); | |
140 | |
141 bool get editing => getShadowRoot("todo-row").query('#label').xtag.editing; | |
142 String get _completedClass => todo.done ? css['.completed'] : ''; | |
143 String get _editingClass => editing ? css['.editing'] : ''; | |
144 } | |
145 </script> | |
146 </element> | |
147 </body> | 133 </body> |
148 </html> | 134 </html> |
OLD | NEW |