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 tracker.web.task_form_element; | 5 library tracker.web.task_form_element; |
6 | 6 |
7 import 'package:polymer/polymer.dart'; | 7 import 'package:polymer/polymer.dart'; |
8 import 'package:tracker/models.dart'; | 8 import 'package:tracker/models.dart'; |
9 import 'dart:html'; | 9 import 'dart:html'; |
10 import 'dart:math'; | 10 import 'dart:math'; |
11 | 11 |
12 @CustomTag('task-form-element') | 12 @CustomTag('task-form-element') |
13 class TaskFormElement extends PolymerElement with ObservableMixin { | 13 class TaskFormElement extends PolymerElement with Observable { |
14 bool get applyAuthorStyles => true; | 14 bool get applyAuthorStyles => true; |
15 @observable Task task; | 15 @observable Task task; |
16 @observable String titleErrorMessage = ''; | 16 @observable String titleErrorMessage = ''; |
17 @observable int maxTitleLength = Task.MAX_TITLE_LENGTH; | 17 @observable int maxTitleLength = Task.MAX_TITLE_LENGTH; |
18 @observable String descriptionErrorMessage = ''; | 18 @observable String descriptionErrorMessage = ''; |
19 @observable int maxDescriptionLength = Task.MAX_DESCRIPTION_LENGTH; | 19 @observable int maxDescriptionLength = Task.MAX_DESCRIPTION_LENGTH; |
20 @observable final List<String> taskStatusOptions = toObservable([ | 20 @observable final List<String> taskStatusOptions = toObservable([ |
21 Task.CURRENT, Task.PENDING, Task.COMPLETED]); | 21 Task.CURRENT, Task.PENDING, Task.COMPLETED]); |
22 @observable int statusSelectedIndex = 1; | 22 @observable int statusSelectedIndex = 1; |
23 @observable String previousStatus = ''; | 23 @observable String previousStatus = ''; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 appModel.tasks.add(task); | 104 appModel.tasks.add(task); |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 deleteTask() { | 108 deleteTask() { |
109 if (window.confirm('Are you sure you want to delete this?')) { | 109 if (window.confirm('Are you sure you want to delete this?')) { |
110 appModel.tasks.remove(task); | 110 appModel.tasks.remove(task); |
111 } | 111 } |
112 } | 112 } |
113 } | 113 } |
OLD | NEW |